altalandi 0.6.0 → 0.6.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/README.md +260 -260
- package/altalandi.mjs +330 -325
- package/auth.mjs +223 -223
- package/batch.mjs +620 -620
- package/package.json +1 -1
- package/report.mjs +5 -3
- package/skill/SKILL.md +180 -112
- package/update.mjs +313 -273
package/package.json
CHANGED
package/report.mjs
CHANGED
|
@@ -88,7 +88,7 @@ export function reportMarkdown(input, data, options = {}) {
|
|
|
88
88
|
`| Málsnið | ${options.register || "neutral"} |`,
|
|
89
89
|
`| Innfæddni | ${q.nativenessScore ?? "n/a"}/100 |`,
|
|
90
90
|
`| Ritill | ${tier.writer || "standard"} / ${tier.scoring || "?"} |`,
|
|
91
|
-
`| Auðkenni | ${data?.id || "?"} |`,
|
|
91
|
+
`| Auðkenni | ${data?.runUrl ? `[${data.id}](${data.runUrl})` : data?.id || "?"} |`,
|
|
92
92
|
"",
|
|
93
93
|
"## Fyrir", "", fence(input), "",
|
|
94
94
|
"## Eftir", "", fence(data?.output), "",
|
|
@@ -187,7 +187,7 @@ export function costLines(data, before, after) {
|
|
|
187
187
|
else if (daily != null && daily > 0) parts.push(`ókeypis ${formatInt(daily)} einingar á dag`);
|
|
188
188
|
if (parts.length) lines.push(`- Staða: ${parts.join(" · ")}`);
|
|
189
189
|
else lines.push("- Staða: náðist ekki að sækja (`npx altalandi whoami`)");
|
|
190
|
-
if (balance != null && balance < 50) lines.push("- Bæta við inneign: https://altalandi.is/
|
|
190
|
+
if (balance != null && balance < 50) lines.push("- Bæta við inneign: https://altalandi.is/stjornbord/inneign");
|
|
191
191
|
return lines;
|
|
192
192
|
}
|
|
193
193
|
|
|
@@ -279,7 +279,9 @@ export function reviewMarkdown(input, data, { before = null, after = null, maxCh
|
|
|
279
279
|
}
|
|
280
280
|
|
|
281
281
|
out.push("**Kostnaður**", ...costLines(data, before, after));
|
|
282
|
-
|
|
282
|
+
// The run's own page: the text sent, the result, the checks and the review.
|
|
283
|
+
if (data?.runUrl) out.push(`- Verkið: ${data.runUrl}`);
|
|
284
|
+
else if (data?.id) out.push(`- Auðkenni: \`${data.id}\``);
|
|
283
285
|
return out.join("\n") + "\n";
|
|
284
286
|
}
|
|
285
287
|
|
package/skill/SKILL.md
CHANGED
|
@@ -1,112 +1,180 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: altalandi
|
|
3
|
-
description: >-
|
|
4
|
-
Turn English or stiff, translated or AI-written Icelandic into natural native
|
|
5
|
-
Icelandic through the Altalandi API, with a meaning check and a diff of every
|
|
6
|
-
change. Use when the user mentions Altalandi, or asks for text in proper,
|
|
7
|
-
natural, correct or native Icelandic ("á góðri íslensku", "á réttri íslensku",
|
|
8
|
-
"láttu þetta hljóma eðlilega á íslensku", "translate this into proper
|
|
9
|
-
Icelandic"), including website copy, UI strings, emails and documents meant for
|
|
10
|
-
Icelandic readers. Not for incidental Icelandic in conversation.
|
|
11
|
-
---
|
|
12
|
-
|
|
13
|
-
# Altalandi: native Icelandic, with a meaning check
|
|
14
|
-
|
|
15
|
-
Altalandi rewrites English or stiff Icelandic so it reads as if a native wrote
|
|
16
|
-
it, checks that the meaning held, and lists every change with its reason. Each
|
|
17
|
-
call is paid from the user's free daily units or their credit.
|
|
18
|
-
|
|
19
|
-
**Follow this procedure exactly, every time.** The user must always see the same
|
|
20
|
-
thing: the verdict, the text before and after, each change with its reason, what
|
|
21
|
-
the call cost and what is left. Do not improvise scripts, parse the JSON
|
|
22
|
-
yourself or summarise the result in your own words.
|
|
23
|
-
|
|
24
|
-
##
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
1
|
+
---
|
|
2
|
+
name: altalandi
|
|
3
|
+
description: >-
|
|
4
|
+
Turn English or stiff, translated or AI-written Icelandic into natural native
|
|
5
|
+
Icelandic through the Altalandi API, with a meaning check and a diff of every
|
|
6
|
+
change. Use when the user mentions Altalandi, or asks for text in proper,
|
|
7
|
+
natural, correct or native Icelandic ("á góðri íslensku", "á réttri íslensku",
|
|
8
|
+
"láttu þetta hljóma eðlilega á íslensku", "translate this into proper
|
|
9
|
+
Icelandic"), including website copy, UI strings, emails and documents meant for
|
|
10
|
+
Icelandic readers. Not for incidental Icelandic in conversation.
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Altalandi: native Icelandic, with a meaning check
|
|
14
|
+
|
|
15
|
+
Altalandi rewrites English or stiff Icelandic so it reads as if a native wrote
|
|
16
|
+
it, checks that the meaning held, and lists every change with its reason. Each
|
|
17
|
+
call is paid from the user's free daily units or their credit.
|
|
18
|
+
|
|
19
|
+
**Follow this procedure exactly, every time.** The user must always see the same
|
|
20
|
+
thing: the verdict, the text before and after, each change with its reason, what
|
|
21
|
+
the call cost and what is left. Do not improvise scripts, parse the JSON
|
|
22
|
+
yourself or summarise the result in your own words.
|
|
23
|
+
|
|
24
|
+
## Which way to call it
|
|
25
|
+
|
|
26
|
+
- **A shell is available (Claude Code, Codex, a terminal):** use the command
|
|
27
|
+
line, below. It waits up to 5 minutes per call and handles long texts.
|
|
28
|
+
- **No shell, only the Altalandi tools** (`refine_icelandic`,
|
|
29
|
+
`proofread_icelandic`, `get_refinement_status`, for example in claude.ai or
|
|
30
|
+
ChatGPT): use the tools, and follow "Long texts through the tools" below. The
|
|
31
|
+
tools cannot wait as long as the command line, so long texts go in parts.
|
|
32
|
+
|
|
33
|
+
How long a call takes: a few seconds for a sentence, 10–30 seconds for a
|
|
34
|
+
paragraph, and one to two minutes for a full page of English. A text that fails
|
|
35
|
+
a check is rewritten once more, which can double that.
|
|
36
|
+
|
|
37
|
+
## The procedure (command line)
|
|
38
|
+
|
|
39
|
+
1. **Save the text** to a UTF-8 temporary file, e.g. `altalandi-in.txt` in the
|
|
40
|
+
system temp folder. Never put the text on the command line.
|
|
41
|
+
2. **Run one command and give it time to finish.** Set the shell tool's timeout
|
|
42
|
+
to 10 minutes (600000 ms) or run it in the background and wait for it. Never
|
|
43
|
+
stop it early and never start a second call for the same text while one is
|
|
44
|
+
running: Altalandi is still working and the second call is charged again.
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
npx -y altalandi@latest --review --file <temp>/altalandi-in.txt --out <temp>/altalandi-out.txt
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Add `--domain marketing` for website and product copy, `--register formal`
|
|
51
|
+
for official text, `--register warm` for friendly customer messages.
|
|
52
|
+
3. **Paste its stdout into your reply exactly as printed**, as the first thing in
|
|
53
|
+
your reply. It is Markdown: a verdict line, **Fyrir**, **Eftir**,
|
|
54
|
+
**Breytingar** (each change and its reason), **Kostnaður** (cost of this call,
|
|
55
|
+
balance and free units left) and **Verkið**, the run's own page. Do not
|
|
56
|
+
shorten, reorder, translate or reword it. The run page shows the user the
|
|
57
|
+
text sent, the result and the checks, and lets them approve, reject or edit
|
|
58
|
+
the result there; point them to it when they want to review the work.
|
|
59
|
+
4. **Then act on the exit code:**
|
|
60
|
+
|
|
61
|
+
| Exit | What happened | What you do |
|
|
62
|
+
|---|---|---|
|
|
63
|
+
| 0 | rewritten and verified, or no change needed | the result is in `altalandi-out.txt`. If the user asked you to update a file, apply it from there; otherwise ask whether to apply it |
|
|
64
|
+
| 3 | the rewrite was refused or the meaning could not be verified | keep the user's original text. Say in one sentence that Altalandi left it unchanged and why (the block says why). Do not apply anything |
|
|
65
|
+
| 4 | out of credit | stop. The block shows the balance and the link to add credit. Do not retry |
|
|
66
|
+
| 2 | not logged in | connect (below), then run step 2 again |
|
|
67
|
+
| 1 | other error (network, too many calls, timeout) | the block says what happened. For "too many calls", wait a minute and retry once. For a timeout, see "If a call times out" |
|
|
68
|
+
|
|
69
|
+
5. **Stop there.** After the block and the action, at most one or two sentences
|
|
70
|
+
of your own.
|
|
71
|
+
|
|
72
|
+
A document of several sections (more than about 3,000 characters) goes better
|
|
73
|
+
through the folder run below: it sends each passage separately, two at a time,
|
|
74
|
+
and a passage that fails keeps its original without holding up the rest. Save
|
|
75
|
+
the text as a `.md` file in an empty temporary folder and run the folder steps.
|
|
76
|
+
|
|
77
|
+
## Long texts through the tools
|
|
78
|
+
|
|
79
|
+
1. **Split the text into parts** at paragraph breaks, never inside a sentence:
|
|
80
|
+
at most **1,000 characters** a part for English, **1,500** for Icelandic.
|
|
81
|
+
Keep a heading with the paragraph under it. A list or a table stays in one
|
|
82
|
+
part when it fits.
|
|
83
|
+
2. **Call the tool once per part,** at most 3 at a time, in order. Give every
|
|
84
|
+
part its own new `operationId` (a fresh UUID). Keep a note of which ID
|
|
85
|
+
belongs to which part.
|
|
86
|
+
3. **Join the results in the original order** and give the user the whole text,
|
|
87
|
+
then each part's verdict and changes, as the tool returns them.
|
|
88
|
+
4. **A part that is refused or unverified keeps its original text.** Say which
|
|
89
|
+
part, and why (the tool says why). Never rewrite it yourself.
|
|
90
|
+
5. **Terms must match across parts.** If two parts translate the same term
|
|
91
|
+
differently, point it out and ask which to keep; do not quietly change one.
|
|
92
|
+
|
|
93
|
+
## If a call times out
|
|
94
|
+
|
|
95
|
+
A timeout means the answer did not reach you, not that the work stopped.
|
|
96
|
+
Altalandi keeps working and charges for the call once.
|
|
97
|
+
|
|
98
|
+
With the command line this is rare (it waits 5 minutes). If it happens, do
|
|
99
|
+
not run the text again: tell the user, and that they can see whether it was
|
|
100
|
+
charged at https://altalandi.is/stjornbord/notkun. With the tools:
|
|
101
|
+
|
|
102
|
+
1. **Call `get_refinement_status` with the same `operationId`.** It costs
|
|
103
|
+
nothing.
|
|
104
|
+
2. **Act on the status:**
|
|
105
|
+
|
|
106
|
+
| Status | What you do |
|
|
107
|
+
|---|---|
|
|
108
|
+
| `completed` with the result | use the result as if the call had answered |
|
|
109
|
+
| `completed` without the result | the call finished and was charged, but the text was not kept. Tell the user, and ask before sending that part again with a new `operationId` (it is charged again) |
|
|
110
|
+
| `pending` | still working. Wait 30 seconds and check again, up to 4 times. Do not send the text again meanwhile |
|
|
111
|
+
| `rejected` or `not_found` (`retryable: true`) | nothing was charged. Send the same part again with the **same** `operationId` |
|
|
112
|
+
| `uncertain` | do not retry. Tell the user the call may or may not have finished, and that they can check their usage at https://altalandi.is/stjornbord/notkun |
|
|
113
|
+
|
|
114
|
+
3. **Never get round the protection** by inventing a new `operationId` for a
|
|
115
|
+
text that may still be running. It charges the user twice.
|
|
116
|
+
4. **Next time, send smaller parts** (see above).
|
|
117
|
+
|
|
118
|
+
## Rules
|
|
119
|
+
|
|
120
|
+
- **Never hand-edit the Icelandic and present it as Altalandi's.** If you think
|
|
121
|
+
something should still change, say so separately under a heading such as
|
|
122
|
+
"Mín tillaga (ekki yfirfarin af Altalandi)", or ask before running it again.
|
|
123
|
+
- **One call per coherent text** (a page section, an email, one UI string). For
|
|
124
|
+
a few strings, run them one by one, at most 4 at a time, and paste each block.
|
|
125
|
+
Keep keys, placeholders (`{name}`, `%s`), HTML and code out of the text you send.
|
|
126
|
+
For a whole folder, i18n catalog or website, use the folder run below instead.
|
|
127
|
+
- **Product names and coined words** the meaning check cannot recognise can make
|
|
128
|
+
it refuse a rewrite (exit 3, "ekki tókst að staðfesta"). That is the safe
|
|
129
|
+
result: keep the original and tell the user.
|
|
130
|
+
- **A long text** is shortened in the block; the whole result is in
|
|
131
|
+
`altalandi-out.txt`. Use `--report` when the user wants a full record: it
|
|
132
|
+
writes `./altalandi-reports/altalandi-<time>-<id>.md`, and the block shows
|
|
133
|
+
its path. Reports contain the text, so write them only when asked.
|
|
134
|
+
- **Don't use `--fast`** for text people will read: it skips the meaning check.
|
|
135
|
+
- If the user only wants spelling fixed and every other word kept, use the
|
|
136
|
+
`proofread_icelandic` tool where it is available. The command line rewrites:
|
|
137
|
+
tell the user it may rephrase, and go through the changes with them.
|
|
138
|
+
- Every call from a signed-in account is kept in that account's history for
|
|
139
|
+
90 days, so the run page can show it; only the account and its team see it,
|
|
140
|
+
and it can be deleted on the page or switched off in Settings. Separately,
|
|
141
|
+
free use is kept, with personal data scrubbed, to improve the service; paid
|
|
142
|
+
use only with consent. Add `--no-store` when the user asks that their text
|
|
143
|
+
not be kept, or when it is confidential: the call is then kept nowhere, and
|
|
144
|
+
its run page shows only the figures.
|
|
145
|
+
|
|
146
|
+
## A whole folder, i18n catalog or website
|
|
147
|
+
|
|
148
|
+
One command refines every `.md`, `.txt`, `.html` and `.json` file in a folder,
|
|
149
|
+
or a web page, or a site. It keeps code, URLs, placeholders, tags and JSON keys
|
|
150
|
+
byte for byte, never writes to the input, and writes only changes whose meaning
|
|
151
|
+
check passed.
|
|
152
|
+
|
|
153
|
+
1. **Estimate first:** `npx -y altalandi@latest <folder or URL> --dry-run` (add
|
|
154
|
+
`--site` for a whole site). Show the user the estimate it prints: files,
|
|
155
|
+
passages, characters, units and the price if paid from credit.
|
|
156
|
+
2. **Only when the user agrees,** run the same command with `--yes` in place of
|
|
157
|
+
`--dry-run`, with the shell timeout set to 10 minutes or in the background.
|
|
158
|
+
The result goes to `<folder>-is` unless they name a place (`--out <path>`).
|
|
159
|
+
3. **Show the summary it prints and the report's path.** Exit 0: done. Exit 2:
|
|
160
|
+
done, but some passages kept their original text; the report lists them and
|
|
161
|
+
why. Exit 4: out of credit; the finished files are written, and the same
|
|
162
|
+
command finishes the rest after a top-up.
|
|
163
|
+
|
|
164
|
+
## Connect this computer (once)
|
|
165
|
+
|
|
166
|
+
Only when a call exits with 2 (`Not logged in`):
|
|
167
|
+
|
|
168
|
+
1. Run `npx -y altalandi@latest login` **in the background**. It waits up to 10
|
|
169
|
+
minutes.
|
|
170
|
+
2. As soon as it prints a link (`https://altalandi.is/tengja?kodi=XXXX-XXXX`) and
|
|
171
|
+
a code, show both to the user. Tell them to sign in or create an account
|
|
172
|
+
(2,000 free units a day, and 500 kr. of trial credit once they confirm their email) and
|
|
173
|
+
click **Tengja**.
|
|
174
|
+
3. When it prints `✓ Tengt sem <username>`, run step 2 of the procedure again.
|
|
175
|
+
|
|
176
|
+
Never ask the user for an API key, and do not tell them to set
|
|
177
|
+
`ALTALANDI_API_KEY`. `npx -y altalandi@latest whoami` shows the account, the
|
|
178
|
+
balance and the free units at any time.
|
|
179
|
+
|
|
180
|
+
Docs for building the API into an app: https://altalandi.is/agents.md
|