@alva-ai/toolkit 0.36.0 → 0.37.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.
@@ -3043,7 +3043,11 @@ declare class ThesesResource {
3043
3043
  }>;
3044
3044
  signals(id: ThesisID, params?: ListThesisSignalsParams): Promise<ThesisSignalsResponse>;
3045
3045
  update(id: ThesisID, params: UpdateThesisParams): Promise<ThesisResponse>;
3046
- /** Archive or restore the current version without asking callers to resend its body. */
3046
+ /**
3047
+ * Archive or unarchive the current version without asking callers to resend
3048
+ * its body. Unarchiving publishes the current content as a new Update; an
3049
+ * archived Thesis takes no other Update.
3050
+ */
3047
3051
  setArchived(id: ThesisID, params: SetThesisArchivedParams): Promise<ThesisResponse>;
3048
3052
  setStarred(id: ThesisID, isStarred: boolean): Promise<ThesisStarredResponse>;
3049
3053
  setSignalEnabled(id: ThesisID, enabled: boolean): Promise<ThesisSignalEnabledResponse>;
package/dist/dispatch.js CHANGED
@@ -6108,9 +6108,6 @@ var EMBEDDED_COMMAND_DEFINITIONS = [
6108
6108
  route("thesis archive", "thesis archive", {
6109
6109
  values: ["id", "request-id", "note"]
6110
6110
  }),
6111
- route("thesis restore", "thesis restore", {
6112
- values: ["id", "request-id", "note"]
6113
- }),
6114
6111
  route("thesis star", "thesis star", { values: ["id"] }),
6115
6112
  route("thesis unstar", "thesis unstar", { values: ["id"] }),
6116
6113
  route("thesis set-signal-enabled", "thesis set-signal-enabled", {
@@ -6127,7 +6124,8 @@ var EMBEDDED_COMMAND_DEFINITIONS = [
6127
6124
  "entity-stances",
6128
6125
  "medias",
6129
6126
  "visibility",
6130
- "track-return"
6127
+ "track-return",
6128
+ "archived"
6131
6129
  ]
6132
6130
  }),
6133
6131
  route("thesis rewrite", "thesis rewrite", { values: ["body", "mode"] }),
@@ -6672,7 +6670,7 @@ Examples:
6672
6670
  alva for-you theses --cursor '<nextCursor>'`,
6673
6671
  thesis: `Usage: alva thesis <subcommand> [options]
6674
6672
 
6675
- Subcommands: list, related, asset-candidates, create, get, version get, signals, watchpoints, set-visibility, archive, restore, star, unstar, set-signal-enabled, update, rewrite.
6673
+ Subcommands: list, related, asset-candidates, create, get, version get, signals, watchpoints, set-visibility, archive, star, unstar, set-signal-enabled, update, rewrite.
6676
6674
 
6677
6675
  list --person <slug> | --person-name <name> | --user <username>
6678
6676
  | --ticker <ticker> | --entity-id <id>
@@ -6718,25 +6716,28 @@ local filesystem or stdin adapter. Rewrite accepts --mode reformat|shorten|enric
6718
6716
  only omission defaults to canonical reformat, which is sent to the API. Create defaults --visibility to public.
6719
6717
  Set-visibility changes current access without publishing a new author version.
6720
6718
  It requires --id and --visibility public|private and never uses a request ID.
6721
- Archive and restore preserve the current Thesis fields and use the current
6722
- author version for optimistic concurrency. They require --id and a caller-supplied
6723
- non-zero --request-id; an optional --note is stored on the new author version.
6719
+ Archive preserves the current Thesis fields and uses the current author version
6720
+ for optimistic concurrency. It requires --id and a caller-supplied non-zero
6721
+ --request-id; an optional --note is the archive note. An archived Thesis takes
6722
+ no Update except the one that unarchives it: update --archived false publishes
6723
+ the Update and unarchives the Thesis, also with unchanged content.
6724
6724
  star and unstar set the viewer's bookmark without changing the Thesis or alert
6725
6725
  subscriptions. set-signal-enabled --id <id> --enabled true|false pauses or
6726
6726
  resumes managed Signal research and returns the resulting research state.
6727
- Archive and restore preserve the current Thesis fields and use the current
6728
- author version for optimistic concurrency. A repeated request in the requested
6729
- state is an idempotent read; stale content, incomplete directions, mismatched
6730
- IDs, and noncanonical GraphQL errors fail closed. The returned state is the
6727
+ A repeated archive request in the requested state is an idempotent read;
6728
+ stale content, incomplete directions, mismatched IDs, and noncanonical GraphQL
6729
+ errors fail closed. The returned state is the
6731
6730
  authority for archive, bookmark, and research results.
6732
6731
  Update requires both --expected-author-version-id and --visibility, preventing
6733
6732
  inadvertent publication, and replaces the document's body, title, and entity
6734
- IDs and directions as a full author-version update. Each update publishes a new
6735
- Update; a published Update cannot be edited in place. Update accepts --entity-stances <json>.
6733
+ IDs and directions as a full author-version update. Each update that changes
6734
+ the content publishes a new Update; one identical to the current Update writes
6735
+ nothing and returns unchanged: true. A published Update cannot be edited in
6736
+ place. Update accepts --entity-stances <json>.
6736
6737
  Only editing the body? Resubmit the existing entity IDs, directions, and medias.
6737
6738
  Pass current medias unchanged with --medias; omission clears attachments.
6738
6739
  On an Update, an omitted or unknown direction of a carried ticker keeps its
6739
- previous direction; none is an exit.
6740
+ previous direction; none is an exit, also for the last long or short.
6740
6741
  Create and update require a caller-supplied non-zero
6741
6742
  UUID in --request-id; the dispatcher never creates request IDs or retries.
6742
6743
 
@@ -7874,7 +7875,6 @@ var COMMAND_DEFINITIONS = [
7874
7875
  command("thesis signals", { values: ["id", "first", "cursor"] }),
7875
7876
  command("thesis set-visibility", { values: ["id", "visibility"] }),
7876
7877
  command("thesis archive", { values: ["id", "request-id", "note"] }),
7877
- command("thesis restore", { values: ["id", "request-id", "note"] }),
7878
7878
  command("thesis star", { values: ["id"] }),
7879
7879
  command("thesis unstar", { values: ["id"] }),
7880
7880
  command("thesis set-signal-enabled", { values: ["id", "enabled"] }),
@@ -7890,7 +7890,8 @@ var COMMAND_DEFINITIONS = [
7890
7890
  "entity-stances",
7891
7891
  "medias",
7892
7892
  "visibility",
7893
- "track-return"
7893
+ "track-return",
7894
+ "archived"
7894
7895
  ],
7895
7896
  booleans: ["body-stdin"]
7896
7897
  }),
@@ -12035,7 +12036,7 @@ function formatTradingPairResolved(result) {
12035
12036
  }
12036
12037
 
12037
12038
  // src/cli/dispatch.ts
12038
- var CLI_VERSION = true ? "0.36.0" : "dev";
12039
+ var CLI_VERSION = true ? "0.37.0" : "dev";
12039
12040
  var DEFAULT_RUN_TIMEOUT_MS = 6e5;
12040
12041
  var RUN_TIMEOUT_ENV = "ALVA_RUN_TIMEOUT_MS";
12041
12042
  var GLOBAL_VALUE_FLAGS = Object.entries(GLOBAL_FLAG_DEFINITIONS).filter(([, kind]) => kind === "value").map(([name]) => `--${name}`);
@@ -13465,11 +13466,11 @@ Subcommands:
13465
13466
  watchpoints List a Thesis's current watchpoints
13466
13467
  set-visibility Change current access without publishing a version
13467
13468
  archive Archive the current author version
13468
- restore Restore an archived Thesis
13469
13469
  star Add the Thesis to your bookmarks
13470
13470
  unstar Remove the Thesis from your bookmarks
13471
13471
  set-signal-enabled Enable or disable managed Signal research
13472
- update Publish a new Update replacing body, title, entities, visibility (all sent in full)
13472
+ update Publish a new Update replacing body, title, entities, visibility (all sent in full);
13473
+ with --archived false it also unarchives the Thesis
13473
13474
  rewrite Explicitly request a candidate body rewrite; never called by another command
13474
13475
 
13475
13476
  Body input (create, update, rewrite): choose exactly one:
@@ -13523,29 +13524,32 @@ Other flags:
13523
13524
  Empty when none is stored yet.
13524
13525
  set-visibility --id <id> --visibility public|private
13525
13526
  archive --id <id> --request-id <uuid> [--note <text>]
13526
- restore --id <id> --request-id <uuid> [--note <text>]
13527
13527
  star|unstar --id <id>
13528
13528
  set-signal-enabled --id <id> --enabled true|false
13529
13529
 
13530
13530
  Maintenance behavior:
13531
- archive/restore read the current Thesis first, preserve its body, title,
13532
- entities, directions, and visibility, then publish the state change against
13533
- the current author version. They require a caller-supplied request UUID.
13534
- A repeated request in the requested state is an idempotent read; a version
13535
- conflict or incomplete directions fails without sending a stale update.
13536
- --note is optional and belongs to the new author version.
13531
+ archive reads the current Thesis first, preserves its body, title,
13532
+ entities, directions, and visibility, then archives it against the current
13533
+ author version. It requires a caller-supplied request UUID. A repeated
13534
+ request in the requested state is an idempotent read; a version conflict or
13535
+ incomplete directions fails without sending a stale update. --note is the
13536
+ archive note shown while the Thesis is archived.
13537
+ An archived Thesis takes no Update except the one that unarchives it:
13538
+ update --archived false publishes this Update and unarchives the Thesis,
13539
+ also when the content is unchanged.
13537
13540
  star/unstar change only the signed-in viewer's bookmark and return the
13538
13541
  authoritative bookmark state and count. They do not change Thesis content or
13539
13542
  Signal subscriptions.
13540
13543
  set-signal-enabled changes managed Signal research without deleting history.
13541
13544
  The command returns enabled, research_paused, archived, and author version
13542
13545
  state; GraphQL errors and noncanonical error codes fail closed.
13543
- update --id <id> --request-id <uuid> --expected-author-version-id <id> --body ... --visibility <value> [--title <text>] [--entity-ids <id,id>] [--entity-stances <json>] [--medias <json-array>] [--track-return true|false]
13546
+ update --id <id> --request-id <uuid> --expected-author-version-id <id> --body ... --visibility <value> [--title <text>] [--entity-ids <id,id>] [--entity-stances <json>] [--medias <json-array>] [--track-return true|false] [--archived false]
13544
13547
  For text edits, pass current medias unchanged; omission clears media.
13545
13548
 
13546
13549
  Only editing the body? Resubmit the existing entity IDs and directions.
13547
13550
  On an Update, an omitted or unknown direction of a carried ticker keeps its
13548
- previous direction; none is an exit.
13551
+ previous direction; none is an exit, also for the last long or short. An
13552
+ Update identical to the current one writes nothing: unchanged is true.
13549
13553
  rewrite --body ... [--mode reformat|shorten|enrich]
13550
13554
 
13551
13555
  Rewrite mode defaults only when omitted, and the toolkit always sends the
@@ -14420,6 +14424,15 @@ function thesisTrackReturn(flags, command2) {
14420
14424
  );
14421
14425
  return parsed;
14422
14426
  }
14427
+ function thesisUnarchive(flags, command2) {
14428
+ const raw = flags["archived"];
14429
+ if (raw === void 0) return void 0;
14430
+ if (boolFlag(raw) === false) return false;
14431
+ throw new CliUsageError(
14432
+ `--archived only accepts false for ${command2} (publish and unarchive); use thesis archive to archive`,
14433
+ "thesis"
14434
+ );
14435
+ }
14423
14436
  function thesisEntityStances(flags) {
14424
14437
  const raw = flags["entity-stances"];
14425
14438
  if (raw === void 0) return void 0;
@@ -15169,15 +15182,6 @@ async function executeParsedCommand(client, parsedCommand, meta, deps) {
15169
15182
  note: flags.note
15170
15183
  }
15171
15184
  );
15172
- case "restore":
15173
- return client.theses.setArchived(
15174
- requireFlag(flags, "id", "thesis restore"),
15175
- {
15176
- request_id: requireFlag(flags, "request-id", "thesis restore"),
15177
- archived: false,
15178
- note: flags.note
15179
- }
15180
- );
15181
15185
  case "star":
15182
15186
  return client.theses.setStarred(
15183
15187
  requireFlag(flags, "id", "thesis star"),
@@ -15193,27 +15197,32 @@ async function executeParsedCommand(client, parsedCommand, meta, deps) {
15193
15197
  requireFlag(flags, "id", "thesis set-signal-enabled"),
15194
15198
  thesisBooleanFlag(flags.enabled, "thesis set-signal-enabled")
15195
15199
  );
15196
- case "update":
15197
- return client.theses.update(
15198
- requireFlag(flags, "id", "thesis update"),
15199
- {
15200
- request_id: requireFlag(flags, "request-id", "thesis update"),
15201
- expected_author_version_id: requireFlag(
15202
- flags,
15203
- "expected-author-version-id",
15204
- "thesis update"
15205
- ),
15206
- body: await thesisBodyFromFlags(flags, "thesis update", deps),
15207
- title: flags.title ?? "",
15208
- entity_ids: thesisEntityIDs(flags),
15209
- entity_stances: thesisEntityStances(flags),
15210
- medias: thesisMedias(flags),
15211
- visibility: thesisVisibility(
15212
- requireFlag(flags, "visibility", "thesis update")
15213
- ),
15214
- track_return: thesisTrackReturn(flags, "thesis update")
15215
- }
15216
- );
15200
+ case "update": {
15201
+ const id = requireFlag(flags, "id", "thesis update");
15202
+ const params = {
15203
+ request_id: requireFlag(flags, "request-id", "thesis update"),
15204
+ expected_author_version_id: requireFlag(
15205
+ flags,
15206
+ "expected-author-version-id",
15207
+ "thesis update"
15208
+ ),
15209
+ body: await thesisBodyFromFlags(flags, "thesis update", deps),
15210
+ title: flags.title ?? "",
15211
+ entity_ids: thesisEntityIDs(flags),
15212
+ entity_stances: thesisEntityStances(flags),
15213
+ medias: thesisMedias(flags),
15214
+ visibility: thesisVisibility(
15215
+ requireFlag(flags, "visibility", "thesis update")
15216
+ ),
15217
+ track_return: thesisTrackReturn(flags, "thesis update"),
15218
+ archived: thesisUnarchive(flags, "thesis update")
15219
+ };
15220
+ const response = await client.theses.update(id, params);
15221
+ return {
15222
+ ...response,
15223
+ unchanged: response.thesis.author_version_id === params.expected_author_version_id
15224
+ };
15225
+ }
15217
15226
  case "rewrite":
15218
15227
  return client.theses.rewrite({
15219
15228
  body: await thesisBodyFromFlags(flags, "thesis rewrite", deps),