@davait/aipictury 1.10.5 → 1.11.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/ext/accountUi.js CHANGED
@@ -214,19 +214,20 @@ function register(context, { registry, sessionsView, serverUrl }) {
214
214
  const ok = await vscode.window.showWarningMessage('Delete everything of yours kept with your AIPictury account?', {
215
215
  modal: true, detail: 'Conversations and projects, rules, preferences, usage, your pictures and clips (Renders, and every file kept '
216
216
  + 'with them), remote-control links and the list of your machines — from every machine and the web app; and on your GPU '
217
- + 'server, its copies of your renders, chats and attached files. What is on this machine stays, and is not sent back up by '
218
- + 'itself: only what you do from now on is kept again (while its switch is on).' }, yes)
217
+ + 'server, its copies of your renders, chats and attached files. Your GPU server choice stays (it is how your apps find it). '
218
+ + 'What is on this machine stays, and is not sent back up by itself: only what you do from now on is kept again (while '
219
+ + 'its switch is on).' }, yes)
219
220
  if (ok !== yes) return null
221
+ const server = gpuServer.url() // read first: the delete must find it
220
222
  const n = await cloud.deleteEverything()
221
- const there = await forgetOnServer('all')
223
+ const there = await forgetOnServer('all', server)
222
224
  return `Deleted (${n} records and files)${there}. Your account stays — sign out or keep using it.`
223
225
  }
224
226
 
225
227
  /** The GPU server's own copies of the account's work go too — renders, chats, attached files,
226
228
  * its copy of the rules: the web app listed them (Renders) and copied them back. Said, not
227
229
  * hidden, when the server cannot be reached. */
228
- async function forgetOnServer(what) {
229
- const server = gpuServer.url()
230
+ async function forgetOnServer(what, server = gpuServer.url()) {
230
231
  if (!server) return '; no GPU server is set, so nothing there was touched'
231
232
  try {
232
233
  const r = await fetch(`${server}/api/account/data?what=${what}`, { method: 'DELETE', signal: AbortSignal.timeout(120_000) })
@@ -246,9 +247,10 @@ function register(context, { registry, sessionsView, serverUrl }) {
246
247
  const ok = await vscode.window.showWarningMessage(`No longer keeping your ${KIND_LABEL[kind] || kind} with your account. Delete the ones already kept?`, {
247
248
  modal: true, detail: 'From every machine and the web app. What is on this machine stays.' }, yes, 'Keep them')
248
249
  if (ok !== yes) return null
250
+ const server = gpuServer.url()
249
251
  const n = await cloud.deleteKind(kind)
250
252
  // Conversations: the GPU server's copies of the web app's chats go too (else copied back).
251
- const there = kind === 'conversations' ? await forgetOnServer('chats') : ''
253
+ const there = kind === 'conversations' ? await forgetOnServer('chats', server) : ''
252
254
  return `No longer sent, and the ${KIND_LABEL[kind] || kind} kept before are deleted (${n} records${there}).`
253
255
  }
254
256
 
package/ext/cloud.js CHANGED
@@ -378,6 +378,7 @@ class Cloud {
378
378
  async deleteKind(kind) {
379
379
  const base = await this.base()
380
380
  const writes = []
381
+ let kept = null
381
382
  if (kind === 'conversations' || kind === 'memory') {
382
383
  for (const p of await this.db.list(`${base}/projects`)) {
383
384
  if (kind === 'memory') { writes.push({ delete: `${base}/projects/${p.id}/memory/current` }); continue }
@@ -391,19 +392,31 @@ class Cloud {
391
392
  if (kind === 'memory') writes.push({ delete: `${base}/memory/rules` })
392
393
  } else if (kind === 'settings') {
393
394
  writes.push({ delete: `${base}/settings/preferences` })
395
+ kept = await this.serverChoice()
394
396
  } else if (kind === 'usage') {
395
397
  for (const d of await this.db.list(`${base}/usage`)) writes.push({ delete: `${base}/usage/${d.id}` })
396
398
  } else {
397
399
  throw new Error(`nothing kept as ${kind}`)
398
400
  }
399
401
  await this.db.batch(writes)
402
+ if (kept) await this.keepServerChoice(kept)
400
403
  if (kind === 'conversations') this.pushed.clear()
401
404
  return writes.length
402
405
  }
403
406
 
407
+ /** The GPU server chosen with the account (its addresses), or null. */
408
+ async serverChoice() { return (await this.getPreferences().catch(() => null))?.values?.gpuServer || null }
409
+
410
+ /** Put back after a delete: it is how every app finds your server (VS Code reads it from the
411
+ * account), not something you made — deleting it left VS Code with no server at all. */
412
+ async keepServerChoice(gpuServer) {
413
+ await this.db.set(`${await this.base()}/settings/preferences`, { values: { gpuServer }, updated: Date.now(), device: this.device.id })
414
+ }
415
+
404
416
  async deleteEverything() {
405
417
  const base = await this.base()
406
418
  const writes = []
419
+ const server = await this.serverChoice()
407
420
  for (const p of await this.db.list(`${base}/projects`)) {
408
421
  for (const c of await this.db.list(`${base}/projects/${p.id}/conversations`)) {
409
422
  // Every chunk there is, not as many as the summary says: one left by a save cut short stays otherwise.
@@ -421,6 +434,7 @@ class Cloud {
421
434
  if (this.storage) for (const o of await this.storage.list(`${base}/media/`)) { await this.storage.delete(o.name); writes.push(o) }
422
435
  // The moment it was cleared: no app carries back up what it still holds from before.
423
436
  await this.db.set(base, { cleared: Date.now() })
437
+ if (server) await this.keepServerChoice(server)
424
438
  this.pushed.clear()
425
439
  return writes.length
426
440
  }
package/ext/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "aipictury",
3
3
  "displayName": "AIPictury",
4
4
  "description": "A coding agent and a generation studio running on your own GPU, with uncensored local models.",
5
- "version": "1.10.5",
5
+ "version": "1.11.0",
6
6
  "publisher": "aipictury",
7
7
  "license": "SEE LICENSE IN LICENSE.md",
8
8
  "engines": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@davait/aipictury",
3
- "version": "1.10.5",
3
+ "version": "1.11.0",
4
4
  "description": "The AIPictury agent in a terminal: the VS Code extension's agent, on your own GPU server, signed in to your AIPictury account.",
5
5
  "bin": {
6
6
  "aipictury": "main.js"