promptlike 0.12.2 → 0.12.4
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/CHANGELOG.md +22 -0
- package/README.md +8 -6
- package/dist/commands/feedback.js +21 -5
- package/dist/lib/loopApi.js +2 -1
- package/dist/program.js +4 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.12.4 — 2026-10-31
|
|
4
|
+
|
|
5
|
+
- **Fix: `ple improve` and `ple loop` crashed on Node 18** (`crypto is not defined`): the attempt id used the global
|
|
6
|
+
`crypto`, which Node 18 does not have. It now imports it. A test fails if any source file uses the global again,
|
|
7
|
+
and CI loads every compiled module and runs a command on Node 18, 20 and 22.
|
|
8
|
+
- **`ple feedback` names the real reason a queued report is anonymous** (no account signed in, the saved login could
|
|
9
|
+
not be checked while offline, or the login is no longer valid / the server did not accept it), also as
|
|
10
|
+
`"anonymous_reason"` in `--json`. Before, a login the server had refused (401/403) followed by a server error was
|
|
11
|
+
described as "no account was signed in". Exit code `4` in `--help` and the README now also covers `list` and
|
|
12
|
+
`close` ("nothing was changed"), and the offline-and-expired-session and signed-out-by-sending-time cases are listed.
|
|
13
|
+
|
|
14
|
+
## 0.12.3 — 2026-10-30
|
|
15
|
+
|
|
16
|
+
- **Fix: a queued report could be tagged with the wrong account.** The account id was read after a failed send, the
|
|
17
|
+
token before it: if another terminal switched accounts in between, one account's note could be queued under (and
|
|
18
|
+
later sent as) the other. Token and account id now come from one read of the saved login.
|
|
19
|
+
- **`ple feedback` now says whether a queued report was written under an account** (a line in the text output,
|
|
20
|
+
`"account": true|false` in `--json`), and `--help` and the README spell out when a queued report goes out
|
|
21
|
+
anonymously: signed out or the login could not be checked, another account signed in at sending time, a session
|
|
22
|
+
about to expire, or one the server refuses. The help text no longer says `PLE_FEEDBACK_QUEUE=off` only "turns that
|
|
23
|
+
off"; it writes nothing, as since 0.12.2.
|
|
24
|
+
|
|
3
25
|
## 0.12.2 — 2026-10-30
|
|
4
26
|
|
|
5
27
|
- **Fix: `PLE_FEEDBACK_QUEUE=off` now writes nothing.** It used to stop only the sending later; an undelivered
|
package/README.md
CHANGED
|
@@ -749,7 +749,7 @@ ple feedback --type missing --json "no way to rename a repo from the CLI"
|
|
|
749
749
|
| `--prompt <title\|id>` | The prompt it is about: its **title or id**, never its text |
|
|
750
750
|
| `--email <address>` | Where to answer you (optional) |
|
|
751
751
|
| `--agent <name>` | Mark the report as written by an AI agent with this name |
|
|
752
|
-
| `--json` | One JSON line on stdout: `{"ok":true,"id":"…","exit_code":0,…}` — on failure `{"ok":false,"exit_code":2,"error":"…"}`, or `{"ok":false,"queued":true,"exit_code":4,…}` |
|
|
752
|
+
| `--json` | One JSON line on stdout: `{"ok":true,"id":"…","exit_code":0,…}` — on failure `{"ok":false,"exit_code":2,"error":"…"}`, or `{"ok":false,"queued":true,"account":true,"exit_code":4,…}` (`"queued":false` with `PLE_FEEDBACK_QUEUE=off`; `account` says whether it was written under an account) |
|
|
753
753
|
|
|
754
754
|
It never asks a question and never waits for input, so an agent can call it. A message is 1 to 2000 characters;
|
|
755
755
|
one that looks like an API key or token is **refused** (the kind is named, the value never echoed).
|
|
@@ -769,14 +769,16 @@ anonymous. Who wrote it is decided from `--agent`, else from `PLE_AGENT=<name>`,
|
|
|
769
769
|
| `1` | Something unexpected |
|
|
770
770
|
| `2` | Usage or validation error — nothing was sent (bad flag, empty or too long message, secret found, rejected by the server) |
|
|
771
771
|
| `3` | Rate limited — try again after the delay shown |
|
|
772
|
-
| `4` | Server or network problem — the report was saved to the local queue (with `PLE_FEEDBACK_QUEUE=off`: nothing was saved) |
|
|
772
|
+
| `4` | Server or network problem — the report was saved to the local queue (with `PLE_FEEDBACK_QUEUE=off`: nothing was saved); `list` / `close`: nothing was changed |
|
|
773
773
|
|
|
774
774
|
**Offline queue.** A report that could not be delivered is saved to `~/.promptlike/feedback/queue.json` (at most 50;
|
|
775
775
|
the oldest is dropped when it is full; mode `0600`). After any other `ple` command it is sent silently, with a
|
|
776
776
|
2 second limit, at most once every 15 minutes, never after the offline commands (`save`, `log`, `diff`, `rollback`,
|
|
777
777
|
`suggest`, `import`) and never when the command failed. A report written while you are signed in is sent with that
|
|
778
|
-
same account only
|
|
779
|
-
|
|
778
|
+
same account only, and only while that account is still signed in with a session that is not about to expire and
|
|
779
|
+
that the server accepts. In every other case it goes out anonymously: written signed out (or while the saved login
|
|
780
|
+
could not be checked, e.g. offline with an expired session), signed out by the time it is sent, another account
|
|
781
|
+
signed in at sending time, or the session refused. Signing in later never attaches an older report to the new account. Turn it off with `PLE_FEEDBACK_QUEUE=off`: then nothing is written to disk and a report that cannot be
|
|
780
782
|
delivered is simply not sent (exit code 4, run `ple feedback` again when you are online).
|
|
781
783
|
|
|
782
784
|
**Pointer on a miss.** When `ple search` finds nothing, or `ple get` fails, one line goes to stderr:
|
|
@@ -854,8 +856,8 @@ Scripts should treat any non-zero code as failure; `2` is the one worth retrying
|
|
|
854
856
|
command: `ple whoami-typo` prints `error: unknown command` with the nearest command and exits `2`, like a usage
|
|
855
857
|
error in `ple feedback`; retrying will not help.
|
|
856
858
|
|
|
857
|
-
`ple feedback` has its own table (`0` sent · `1` unexpected · `2` usage or validation · `3` rate limited · `4`
|
|
858
|
-
later) — see [its section](#ple-feedback-message--tell-the-maker-what-is-missing-or-broken).
|
|
859
|
+
`ple feedback` has its own table (`0` sent · `1` unexpected · `2` usage or validation · `3` rate limited · `4` server or network
|
|
860
|
+
problem: queued for later, or not saved with `PLE_FEEDBACK_QUEUE=off`) — see [its section](#ple-feedback-message--tell-the-maker-what-is-missing-or-broken).
|
|
859
861
|
|
|
860
862
|
## Security notes
|
|
861
863
|
|
|
@@ -43,7 +43,7 @@ exports.FEEDBACK_EXIT_CODES_HELP = [
|
|
|
43
43
|
'1 unexpected problem (list / close: also not signed in, or not allowed)',
|
|
44
44
|
'2 usage or validation error — nothing was sent',
|
|
45
45
|
'3 rate limited — try again after the delay shown',
|
|
46
|
-
'4 server or network problem — saved to the local queue
|
|
46
|
+
'4 server or network problem — a report is saved to the local queue and sent by a later `ple` command (PLE_FEEDBACK_QUEUE=off: not saved); list / close: nothing was changed',
|
|
47
47
|
];
|
|
48
48
|
// ---------------------------------------------------------------------------
|
|
49
49
|
// Output
|
|
@@ -65,18 +65,20 @@ function fail(json, code, error, extra = {}) {
|
|
|
65
65
|
// ---------------------------------------------------------------------------
|
|
66
66
|
// ple feedback "<message>"
|
|
67
67
|
// ---------------------------------------------------------------------------
|
|
68
|
+
/** The token and the id of the account it belongs to, read from ONE snapshot of the saved login (another terminal may switch accounts at any moment). */
|
|
68
69
|
async function defaultToken() {
|
|
69
70
|
if ((0, config_1.configStatus)() !== 'valid')
|
|
70
71
|
return {};
|
|
71
72
|
try {
|
|
72
73
|
await (0, api_client_1.ensureAuthed)();
|
|
73
|
-
|
|
74
|
+
const config = (0, config_1.readConfig)();
|
|
75
|
+
return { token: config?.access_token, userId: config?.user_id || undefined };
|
|
74
76
|
}
|
|
75
77
|
catch (err) {
|
|
76
78
|
// The server could not be reached to refresh the session: it cannot take the report either.
|
|
77
79
|
if (err instanceof api_client_1.NetworkError || err instanceof api_client_1.RequestTimeoutError)
|
|
78
80
|
return { unreachable: err.message };
|
|
79
|
-
return {}; // a dead session must not block a report: it goes out anonymously
|
|
81
|
+
return { dead: true }; // a dead session must not block a report: it goes out anonymously
|
|
80
82
|
}
|
|
81
83
|
}
|
|
82
84
|
async function feedbackCommand(messageParts, opts = {}, deps = {}) {
|
|
@@ -115,6 +117,9 @@ async function submit(message, opts, deps, json) {
|
|
|
115
117
|
const send = deps.send ?? ((p, o) => (0, feedbackApi_1.sendFeedback)(p, o));
|
|
116
118
|
let result;
|
|
117
119
|
let attachedAccount = Boolean(auth.token);
|
|
120
|
+
// Why a report is NOT tied to an account (said when it is queued): nobody signed in, the login could not be
|
|
121
|
+
// checked (offline), or the login is dead / refused by the server.
|
|
122
|
+
let anonReason = auth.unreachable ? 'unchecked' : auth.dead ? 'refused' : 'signed_out';
|
|
118
123
|
if (auth.unreachable) {
|
|
119
124
|
result = { kind: 'unavailable', message: auth.unreachable };
|
|
120
125
|
attachedAccount = false;
|
|
@@ -124,6 +129,7 @@ async function submit(message, opts, deps, json) {
|
|
|
124
129
|
if (result.kind === 'auth' && auth.token) {
|
|
125
130
|
// The server did not accept the session: the report still matters, send it without one.
|
|
126
131
|
attachedAccount = false;
|
|
132
|
+
anonReason = 'refused';
|
|
127
133
|
result = await send(payload, { token: undefined });
|
|
128
134
|
}
|
|
129
135
|
}
|
|
@@ -147,14 +153,19 @@ async function submit(message, opts, deps, json) {
|
|
|
147
153
|
return fail(json, exports.EXIT_RATE_LIMITED, `Rate limited. Try again${wait !== undefined ? ` in ${wait}s` : ' in a moment'}.`, { retry_after: wait ?? null });
|
|
148
154
|
}
|
|
149
155
|
case 'unavailable':
|
|
150
|
-
return queueIt(payload, result.message, json, env, deps, base, attachedAccount ?
|
|
156
|
+
return queueIt(payload, result.message, json, env, deps, base, attachedAccount ? auth.userId : undefined, anonReason);
|
|
151
157
|
case 'auth':
|
|
152
158
|
return fail(json, exports.EXIT_UNEXPECTED, `The server refused the report (HTTP ${result.status}).`);
|
|
153
159
|
default:
|
|
154
160
|
return fail(json, exports.EXIT_UNEXPECTED, `Unexpected answer from the server (HTTP ${result.status}): ${result.message}`);
|
|
155
161
|
}
|
|
156
162
|
}
|
|
157
|
-
|
|
163
|
+
const ANON_REASON_TEXT = {
|
|
164
|
+
signed_out: 'no account was signed in',
|
|
165
|
+
unchecked: 'the saved login could not be checked while offline',
|
|
166
|
+
refused: 'the saved login is no longer valid or the server did not accept it',
|
|
167
|
+
};
|
|
168
|
+
function queueIt(payload, reason, json, env, deps, base, userId, anonReason) {
|
|
158
169
|
// `PLE_FEEDBACK_QUEUE=off`: nothing is written to disk (data minimisation); the report is simply not delivered.
|
|
159
170
|
if (!(0, feedbackQueue_1.queueEnabled)(env)) {
|
|
160
171
|
setExit(exports.EXIT_QUEUED);
|
|
@@ -182,6 +193,8 @@ function queueIt(payload, reason, json, env, deps, base, userId) {
|
|
|
182
193
|
queued: true,
|
|
183
194
|
exit_code: exports.EXIT_QUEUED,
|
|
184
195
|
queue_size: queued.size,
|
|
196
|
+
account: Boolean(userId),
|
|
197
|
+
...(userId ? {} : { anonymous_reason: anonReason }),
|
|
185
198
|
...(queued.droppedOldest ? { dropped_oldest: true } : {}),
|
|
186
199
|
send_later: sendsLater,
|
|
187
200
|
error: reason,
|
|
@@ -191,6 +204,9 @@ function queueIt(payload, reason, json, env, deps, base, userId) {
|
|
|
191
204
|
}
|
|
192
205
|
console.error(format_1.c.warn(`⚠ Could not deliver the report (${reason})`));
|
|
193
206
|
console.error(format_1.c.muted(` Saved to the local queue (${queued.size} waiting${queued.droppedOldest ? ', the oldest one was dropped' : ''}). ${note}`));
|
|
207
|
+
console.error(format_1.c.muted(userId
|
|
208
|
+
? ' Written under your account: it is sent with that account only if it is still signed in then, otherwise anonymously.'
|
|
209
|
+
: ` It will be sent anonymously (${ANON_REASON_TEXT[anonReason]}).`));
|
|
194
210
|
}
|
|
195
211
|
async function ownerAuth() {
|
|
196
212
|
if ((0, config_1.configStatus)() !== 'valid')
|
package/dist/lib/loopApi.js
CHANGED
|
@@ -18,6 +18,7 @@ exports.saveWinner = saveWinner;
|
|
|
18
18
|
exports.createPrompt = createPrompt;
|
|
19
19
|
exports.patchDescription = patchDescription;
|
|
20
20
|
exports.addTagByName = addTagByName;
|
|
21
|
+
const crypto_1 = require("crypto");
|
|
21
22
|
const constants_1 = require("./constants");
|
|
22
23
|
const config_1 = require("./config");
|
|
23
24
|
/**
|
|
@@ -133,7 +134,7 @@ async function requestVariants(promptId, opts = {}) {
|
|
|
133
134
|
const body = {
|
|
134
135
|
// Her tur ayrı bilinçli üretim: nonce, aynı dakikadaki idempotency
|
|
135
136
|
// çakışmasını (bedava üretim + sahte critical alarm) önler.
|
|
136
|
-
attempt:
|
|
137
|
+
attempt: (0, crypto_1.randomUUID)(),
|
|
137
138
|
};
|
|
138
139
|
if (opts.count !== undefined)
|
|
139
140
|
body.count = opts.count;
|
package/dist/program.js
CHANGED
|
@@ -333,7 +333,10 @@ function buildProgram() {
|
|
|
333
333
|
'looks like a key or token is refused.',
|
|
334
334
|
'',
|
|
335
335
|
'If the server cannot be reached the report is saved to ~/.promptlike/feedback/queue.json (max 50) and',
|
|
336
|
-
'sent by a later `ple` command (at most every 15 minutes
|
|
336
|
+
'sent by a later `ple` command (at most every 15 minutes). A report written while you are signed in goes',
|
|
337
|
+
'out with that same account only; otherwise (signed out by then, another account, a session about to expire',
|
|
338
|
+
'or refused, or a login that could not be checked offline) it goes out anonymously. With',
|
|
339
|
+
'PLE_FEEDBACK_QUEUE=off nothing is saved or sent later.',
|
|
337
340
|
'',
|
|
338
341
|
'Exit codes:',
|
|
339
342
|
...feedback_1.FEEDBACK_EXIT_CODES_HELP.map((l) => ` ${l}`),
|
package/package.json
CHANGED