promptlike 0.12.3 → 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 CHANGED
@@ -1,5 +1,16 @@
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
+
3
14
  ## 0.12.3 — 2026-10-30
4
15
 
5
16
  - **Fix: a queued report could be tagged with the wrong account.** The account id was read after a failed send, the
package/README.md CHANGED
@@ -769,7 +769,7 @@ 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
@@ -777,8 +777,8 @@ the oldest is dropped when it is full; mode `0600`). After any other `ple` comma
777
777
  `suggest`, `import`) and never when the command failed. A report written while you are signed in is sent with that
778
778
  same account only, and only while that account is still signed in with a session that is not about to expire and
779
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), another account signed in at sending time, or the
781
- 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
+ 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
782
782
  delivered is simply not sent (exit code 4, run `ple feedback` again when you are online).
783
783
 
784
784
  **Pointer on a miss.** When `ple search` finds nothing, or `ple get` fails, one line goes to stderr:
@@ -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 and sent by a later `ple` command (with PLE_FEEDBACK_QUEUE=off: not saved, not sent)',
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
@@ -78,7 +78,7 @@ async function defaultToken() {
78
78
  // The server could not be reached to refresh the session: it cannot take the report either.
79
79
  if (err instanceof api_client_1.NetworkError || err instanceof api_client_1.RequestTimeoutError)
80
80
  return { unreachable: err.message };
81
- 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
82
82
  }
83
83
  }
84
84
  async function feedbackCommand(messageParts, opts = {}, deps = {}) {
@@ -117,6 +117,9 @@ async function submit(message, opts, deps, json) {
117
117
  const send = deps.send ?? ((p, o) => (0, feedbackApi_1.sendFeedback)(p, o));
118
118
  let result;
119
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';
120
123
  if (auth.unreachable) {
121
124
  result = { kind: 'unavailable', message: auth.unreachable };
122
125
  attachedAccount = false;
@@ -126,6 +129,7 @@ async function submit(message, opts, deps, json) {
126
129
  if (result.kind === 'auth' && auth.token) {
127
130
  // The server did not accept the session: the report still matters, send it without one.
128
131
  attachedAccount = false;
132
+ anonReason = 'refused';
129
133
  result = await send(payload, { token: undefined });
130
134
  }
131
135
  }
@@ -149,14 +153,19 @@ async function submit(message, opts, deps, json) {
149
153
  return fail(json, exports.EXIT_RATE_LIMITED, `Rate limited. Try again${wait !== undefined ? ` in ${wait}s` : ' in a moment'}.`, { retry_after: wait ?? null });
150
154
  }
151
155
  case 'unavailable':
152
- return queueIt(payload, result.message, json, env, deps, base, attachedAccount ? auth.userId : undefined);
156
+ return queueIt(payload, result.message, json, env, deps, base, attachedAccount ? auth.userId : undefined, anonReason);
153
157
  case 'auth':
154
158
  return fail(json, exports.EXIT_UNEXPECTED, `The server refused the report (HTTP ${result.status}).`);
155
159
  default:
156
160
  return fail(json, exports.EXIT_UNEXPECTED, `Unexpected answer from the server (HTTP ${result.status}): ${result.message}`);
157
161
  }
158
162
  }
159
- function queueIt(payload, reason, json, env, deps, base, userId) {
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) {
160
169
  // `PLE_FEEDBACK_QUEUE=off`: nothing is written to disk (data minimisation); the report is simply not delivered.
161
170
  if (!(0, feedbackQueue_1.queueEnabled)(env)) {
162
171
  setExit(exports.EXIT_QUEUED);
@@ -185,6 +194,7 @@ function queueIt(payload, reason, json, env, deps, base, userId) {
185
194
  exit_code: exports.EXIT_QUEUED,
186
195
  queue_size: queued.size,
187
196
  account: Boolean(userId),
197
+ ...(userId ? {} : { anonymous_reason: anonReason }),
188
198
  ...(queued.droppedOldest ? { dropped_oldest: true } : {}),
189
199
  send_later: sendsLater,
190
200
  error: reason,
@@ -196,7 +206,7 @@ function queueIt(payload, reason, json, env, deps, base, userId) {
196
206
  console.error(format_1.c.muted(` Saved to the local queue (${queued.size} waiting${queued.droppedOldest ? ', the oldest one was dropped' : ''}). ${note}`));
197
207
  console.error(format_1.c.muted(userId
198
208
  ? ' Written under your account: it is sent with that account only if it is still signed in then, otherwise anonymously.'
199
- : ' It will be sent anonymously (no account was signed in, or the saved login could not be checked).'));
209
+ : ` It will be sent anonymously (${ANON_REASON_TEXT[anonReason]}).`));
200
210
  }
201
211
  async function ownerAuth() {
202
212
  if ((0, config_1.configStatus)() !== 'valid')
@@ -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: crypto.randomUUID(),
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
@@ -334,8 +334,9 @@ function buildProgram() {
334
334
  '',
335
335
  'If the server cannot be reached the report is saved to ~/.promptlike/feedback/queue.json (max 50) and',
336
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, another account, a session about to expire or',
338
- 'refused) it goes out anonymously. With PLE_FEEDBACK_QUEUE=off nothing is saved or sent later.',
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.',
339
340
  '',
340
341
  'Exit codes:',
341
342
  ...feedback_1.FEEDBACK_EXIT_CODES_HELP.map((l) => ` ${l}`),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "promptlike",
3
- "version": "0.12.3",
3
+ "version": "0.12.4",
4
4
  "description": "Terminal access to your PromptLikeEngineer prompt library - search, read, and copy your saved prompts without leaving the shell.",
5
5
  "bin": {
6
6
  "ple": "dist/index.js"