promptlike 0.12.1 → 0.12.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/CHANGELOG.md +12 -0
- package/README.md +6 -3
- package/dist/commands/feedback.js +16 -7
- package/dist/lib/feedbackQueue.js +15 -5
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.12.2 — 2026-10-30
|
|
4
|
+
|
|
5
|
+
- **Fix: `PLE_FEEDBACK_QUEUE=off` now writes nothing.** It used to stop only the sending later; an undelivered
|
|
6
|
+
`ple feedback` report was still saved to `~/.promptlike/feedback/queue.json`. Now it is not saved at all (exit code
|
|
7
|
+
`4` still says it was not sent; `--json` carries `"queued": false`).
|
|
8
|
+
- **Fix: a queued report is never linked to an account that was not the author's.** A report queued while signed out
|
|
9
|
+
was attached to whichever account was signed in when it was finally sent. A queued report now remembers the account
|
|
10
|
+
id it was written under: it goes out with that same account only, and anonymously otherwise (also for reports
|
|
11
|
+
queued by 0.11.0 to 0.12.1, which stored no id).
|
|
12
|
+
- `ple import --scan` without `--all` on a non-terminal exits 1 too, like `ple import github:…` and `ple import ple:…`
|
|
13
|
+
since 0.12.1 (this was true in 0.12.1 but not written down).
|
|
14
|
+
|
|
3
15
|
## 0.12.1 — 2026-10-30
|
|
4
16
|
|
|
5
17
|
- **Fix: `ple import` exits 1 when nothing was imported because it could not ask.** Run without a terminal (a script,
|
package/README.md
CHANGED
|
@@ -769,12 +769,15 @@ 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 |
|
|
772
|
+
| `4` | Server or network problem — the report was saved to the local queue (with `PLE_FEEDBACK_QUEUE=off`: nothing was saved) |
|
|
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
|
-
`suggest`, `import`) and never when the command failed.
|
|
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; written signed out, it always goes out anonymously, and signing in later never attaches it to your
|
|
779
|
+
account. Turn it off with `PLE_FEEDBACK_QUEUE=off`: then nothing is written to disk and a report that cannot be
|
|
780
|
+
delivered is simply not sent (exit code 4, run `ple feedback` again when you are online).
|
|
778
781
|
|
|
779
782
|
**Pointer on a miss.** When `ple search` finds nothing, or `ple get` fails, one line goes to stderr:
|
|
780
783
|
`Missing something? ple feedback --type missing "..."` (never into the output you pipe).
|
|
@@ -933,7 +936,7 @@ to configure.
|
|
|
933
936
|
| `PLE_SUGGEST=off` | `ple suggest --hook` stays silent |
|
|
934
937
|
| `PLE_UPDATE_CHECK=off` | No update notice, no cache read, no request to npm |
|
|
935
938
|
| `NO_UPDATE_NOTIFIER=1` | Same (any value turns it off, even empty); a non-empty `CI` other than `false` / `0` does too |
|
|
936
|
-
| `PLE_FEEDBACK_QUEUE=off` | Reports that `ple feedback` could not deliver are not
|
|
939
|
+
| `PLE_FEEDBACK_QUEUE=off` | Reports that `ple feedback` could not deliver are not saved and not retried (exit code 4 still tells you it was not sent) |
|
|
937
940
|
| `PLE_AGENT=<name>` | `ple feedback` marks its reports as written by this agent (also read: `AI_AGENT`, `CLAUDECODE`, `CODEX_*`, `CURSOR_*`) |
|
|
938
941
|
| `PLE_SURFACE`, `PLE_VIA` | How `copy/get/show` report a use (e.g. `hook`, `suggestion`) |
|
|
939
942
|
| `PROMPTLIKE_HOME` | Local store location (default `~/.promptlike`) |
|
|
@@ -147,26 +147,35 @@ async function submit(message, opts, deps, json) {
|
|
|
147
147
|
return fail(json, exports.EXIT_RATE_LIMITED, `Rate limited. Try again${wait !== undefined ? ` in ${wait}s` : ' in a moment'}.`, { retry_after: wait ?? null });
|
|
148
148
|
}
|
|
149
149
|
case 'unavailable':
|
|
150
|
-
return queueIt(payload, result.message, json, env, deps, base);
|
|
150
|
+
return queueIt(payload, result.message, json, env, deps, base, attachedAccount ? (deps.accountId ?? (() => (0, config_1.readConfig)()?.user_id))() : undefined);
|
|
151
151
|
case 'auth':
|
|
152
152
|
return fail(json, exports.EXIT_UNEXPECTED, `The server refused the report (HTTP ${result.status}).`);
|
|
153
153
|
default:
|
|
154
154
|
return fail(json, exports.EXIT_UNEXPECTED, `Unexpected answer from the server (HTTP ${result.status}): ${result.message}`);
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
|
-
function queueIt(payload, reason, json, env, deps, base) {
|
|
157
|
+
function queueIt(payload, reason, json, env, deps, base, userId) {
|
|
158
|
+
// `PLE_FEEDBACK_QUEUE=off`: nothing is written to disk (data minimisation); the report is simply not delivered.
|
|
159
|
+
if (!(0, feedbackQueue_1.queueEnabled)(env)) {
|
|
160
|
+
setExit(exports.EXIT_QUEUED);
|
|
161
|
+
if (json) {
|
|
162
|
+
emitJson({ ok: false, queued: false, exit_code: exports.EXIT_QUEUED, send_later: false, error: reason, ...base });
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
console.error(format_1.c.warn(`⚠ Could not deliver the report (${reason})`));
|
|
166
|
+
console.error(format_1.c.muted(' Nothing was saved (PLE_FEEDBACK_QUEUE=off); run `ple feedback` again when you are online.'));
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
158
169
|
let queued;
|
|
159
170
|
try {
|
|
160
|
-
queued = (deps.queue ?? ((p) => (0, feedbackQueue_1.enqueue)(p)))(payload);
|
|
171
|
+
queued = (deps.queue ?? ((p, u) => (0, feedbackQueue_1.enqueue)(p, Date.now(), u)))(payload, userId);
|
|
161
172
|
}
|
|
162
173
|
catch (err) {
|
|
163
174
|
return fail(json, exports.EXIT_UNEXPECTED, `Could not reach the server (${reason}) and could not save the report locally either: ${(0, format_1.safeText)(err instanceof Error ? err.message : String(err)).slice(0, 160)}`);
|
|
164
175
|
}
|
|
165
|
-
const sendsLater =
|
|
176
|
+
const sendsLater = true;
|
|
166
177
|
setExit(exports.EXIT_QUEUED);
|
|
167
|
-
const note =
|
|
168
|
-
? 'It will be sent by a later `ple` command.'
|
|
169
|
-
: 'Sending later is off (PLE_FEEDBACK_QUEUE=off); run `ple feedback` again when you are online.';
|
|
178
|
+
const note = 'It will be sent by a later `ple` command.';
|
|
170
179
|
if (json) {
|
|
171
180
|
emitJson({
|
|
172
181
|
ok: false,
|
|
@@ -11,6 +11,12 @@
|
|
|
11
11
|
* {@link MAX_QUEUE_FILE_BYTES} on disk. A file that is unreadable, too big or not ours reads as empty and
|
|
12
12
|
* is replaced by the next write; a single entry that is off (wrong shape, over a limit) is dropped on its own.
|
|
13
13
|
*
|
|
14
|
+
* Whose report it is: a report queued while signed in remembers the account's id (`user_id`) and is sent later with
|
|
15
|
+
* the session only while that SAME account is signed in. Queued signed out (or from an older version, which stored
|
|
16
|
+
* no id), or when another account is signed in at flush time, it goes out anonymously: signing in afterwards never
|
|
17
|
+
* attaches an earlier note to the new account.
|
|
18
|
+
* `PLE_FEEDBACK_QUEUE=off` means nothing is saved at all (see `ple feedback`), so there is nothing to send later.
|
|
19
|
+
*
|
|
14
20
|
* Sending later: after ANY other `ple` command, at most once every {@link RETRY_INTERVAL_MS}, within a
|
|
15
21
|
* {@link FLUSH_TIMEOUT_MS} budget, silently — no output, every error swallowed (the same idea as the update
|
|
16
22
|
* notice: stamp before the attempt, so a slow or failed one is not retried by the next command in a burst).
|
|
@@ -97,6 +103,7 @@ function readQueue() {
|
|
|
97
103
|
qid: typeof e.qid === 'string' && /^[0-9a-f]{8,32}$/.test(e.qid) ? e.qid : newQid(),
|
|
98
104
|
queued_at: typeof e.queued_at === 'string' ? e.queued_at.slice(0, 40) : '',
|
|
99
105
|
payload,
|
|
106
|
+
...(typeof e.user_id === 'string' && e.user_id && e.user_id.length <= 64 ? { user_id: e.user_id } : {}),
|
|
100
107
|
});
|
|
101
108
|
}
|
|
102
109
|
return { version: 1, last_attempt_at: isTime(o.last_attempt_at) ? o.last_attempt_at : 0, items: items.slice(-exports.QUEUE_MAX) };
|
|
@@ -117,10 +124,10 @@ function writeQueue(state) {
|
|
|
117
124
|
* Add one report. The retry timer starts now (`last_attempt_at`), so the very next command does not try
|
|
118
125
|
* again against a network that just failed. Throws when the file cannot be written.
|
|
119
126
|
*/
|
|
120
|
-
function enqueue(payload, now = Date.now()) {
|
|
127
|
+
function enqueue(payload, now = Date.now(), userId) {
|
|
121
128
|
const state = readQueue();
|
|
122
129
|
const droppedOldest = state.items.length >= exports.QUEUE_MAX;
|
|
123
|
-
const items = [...state.items, { qid: newQid(), queued_at: new Date(now).toISOString(), payload }].slice(-exports.QUEUE_MAX);
|
|
130
|
+
const items = [...state.items, { qid: newQid(), queued_at: new Date(now).toISOString(), payload, ...(userId ? { user_id: userId } : {}) }].slice(-exports.QUEUE_MAX);
|
|
124
131
|
writeQueue({ version: 1, last_attempt_at: now, items });
|
|
125
132
|
return { size: items.length, droppedOldest };
|
|
126
133
|
}
|
|
@@ -136,10 +143,11 @@ function isFlushDue(state, now) {
|
|
|
136
143
|
const age = now - state.last_attempt_at;
|
|
137
144
|
return state.last_attempt_at === 0 || age < 0 || age >= exports.RETRY_INTERVAL_MS;
|
|
138
145
|
}
|
|
139
|
-
|
|
146
|
+
/** The saved session's token and account id, when it is not about to expire. */
|
|
147
|
+
function sessionOf() {
|
|
140
148
|
try {
|
|
141
149
|
const config = (0, config_1.readConfig)();
|
|
142
|
-
return config && !(0, config_1.isTokenExpiringSoon)(config) ? config.access_token : undefined;
|
|
150
|
+
return config && !(0, config_1.isTokenExpiringSoon)(config) ? { token: config.access_token, userId: config.user_id } : undefined;
|
|
143
151
|
}
|
|
144
152
|
catch {
|
|
145
153
|
return undefined;
|
|
@@ -178,13 +186,15 @@ async function flushQueue(deps = {}) {
|
|
|
178
186
|
writeQueue({ ...state, last_attempt_at: now });
|
|
179
187
|
result.attempted = true;
|
|
180
188
|
const send = deps.send ?? ((p, o) => (0, feedbackApi_1.sendFeedback)(p, o));
|
|
181
|
-
const
|
|
189
|
+
const session = deps.session === undefined ? sessionOf() : deps.session ?? undefined;
|
|
182
190
|
const deadline = Date.now() + exports.FLUSH_TIMEOUT_MS;
|
|
183
191
|
const done = new Set();
|
|
184
192
|
for (const item of state.items) {
|
|
185
193
|
const left = deadline - Date.now();
|
|
186
194
|
if (left < 100)
|
|
187
195
|
break;
|
|
196
|
+
// Only the account that queued the report may be attached to it; everything else goes out anonymously.
|
|
197
|
+
const token = session && item.user_id && item.user_id === session.userId ? session.token : undefined;
|
|
188
198
|
let out = await send(item.payload, { token, timeoutMs: left });
|
|
189
199
|
if (out.kind === 'auth' && token) {
|
|
190
200
|
const again = deadline - Date.now();
|
package/package.json
CHANGED