@alva-ai/toolkit 0.28.1-beta.1 → 0.29.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/dist/cli.d.ts CHANGED
@@ -549,6 +549,8 @@ interface PlaybookDraftResponse {
549
549
  playbook_path: string;
550
550
  }
551
551
  interface PlaybookReleaseRequest {
552
+ /** Explicit consent to deliver bundled non-public Feeds to the Playbook audience. */
553
+ confirm_bundled_feed_exposure?: boolean;
552
554
  name: string;
553
555
  version: string;
554
556
  feeds: Array<{
@@ -2351,6 +2353,48 @@ interface ThesisGetResponse extends ThesisResponse {
2351
2353
  author: ThesisAuthor;
2352
2354
  entities: ThesisEntity[];
2353
2355
  }
2356
+ interface ThesisResearchStatus {
2357
+ state: string;
2358
+ pending_work: number;
2359
+ read_complete: boolean;
2360
+ last_attempt_ms?: number;
2361
+ last_completed_ms?: number;
2362
+ }
2363
+ interface ThesisSignalEvidenceExcerpt {
2364
+ text: string;
2365
+ omitted_before: boolean;
2366
+ omitted_after: boolean;
2367
+ }
2368
+ interface ThesisSignalSource {
2369
+ title: string;
2370
+ url?: string;
2371
+ published_at_ms?: number;
2372
+ }
2373
+ interface ThesisSignal {
2374
+ id: ThesisID;
2375
+ thesis_id: ThesisID;
2376
+ author_version_id: ThesisID;
2377
+ statement_snapshot: string;
2378
+ stance: string;
2379
+ explanation: string;
2380
+ information_kind: string;
2381
+ evidence_excerpt?: ThesisSignalEvidenceExcerpt;
2382
+ source: ThesisSignalSource;
2383
+ }
2384
+ interface ThesisSignalEntry {
2385
+ feed_entry_id: ThesisID;
2386
+ cursor: string;
2387
+ signal: ThesisSignal;
2388
+ }
2389
+ interface ListThesisSignalsParams {
2390
+ first?: number;
2391
+ cursor?: string;
2392
+ }
2393
+ interface ThesisSignalsResponse {
2394
+ research: ThesisResearchStatus;
2395
+ entries: ThesisSignalEntry[];
2396
+ next_cursor: string;
2397
+ }
2354
2398
  interface CreateThesisParams {
2355
2399
  /** Caller-supplied, stable non-zero UUID. Reuse it only to resolve ambiguity. */
2356
2400
  request_id: string;
@@ -2397,6 +2441,8 @@ declare class ThesesResource {
2397
2441
  constructor(client: AlvaClient);
2398
2442
  create(params: CreateThesisParams): Promise<ThesisResponse>;
2399
2443
  get(id: ThesisID): Promise<ThesisGetResponse>;
2444
+ getVersion(id: ThesisID, authorVersionID: ThesisID): Promise<ThesisResponse>;
2445
+ signals(id: ThesisID, params?: ListThesisSignalsParams): Promise<ThesisSignalsResponse>;
2400
2446
  update(id: ThesisID, params: UpdateThesisParams): Promise<ThesisResponse>;
2401
2447
  setVisibility(id: ThesisID, params: SetThesisVisibilityParams): Promise<ThesisResponse>;
2402
2448
  close(id: ThesisID, params: CloseThesisParams): Promise<ThesisResponse>;
package/dist/cli.js CHANGED
@@ -6521,7 +6521,8 @@ var ReleaseResource = class {
6521
6521
  version: params.version,
6522
6522
  feeds: params.feeds,
6523
6523
  changelog: params.changelog,
6524
- readme_url: params.readme_url
6524
+ readme_url: params.readme_url,
6525
+ confirm_bundled_feed_exposure: params.confirm_bundled_feed_exposure
6525
6526
  }
6526
6527
  });
6527
6528
  }
@@ -10048,6 +10049,47 @@ var ThesesResource = class {
10048
10049
  await this.client._request("GET", `/api/v1/theses/${requireID(id, "id")}`)
10049
10050
  );
10050
10051
  }
10052
+ async getVersion(id, authorVersionID) {
10053
+ this.client._requireAuth();
10054
+ const thesisID = requireID(id, "id");
10055
+ const versionID = requireID(authorVersionID, "author_version_id");
10056
+ const response = thesisResponse(
10057
+ await this.client._request(
10058
+ "GET",
10059
+ `/api/v1/theses/${thesisID}/versions/${versionID}`
10060
+ )
10061
+ );
10062
+ if (response.thesis.id !== thesisID || response.thesis.author_version_id !== versionID) {
10063
+ throw invalidResponse2(
10064
+ "version response must match the requested thesis and author version"
10065
+ );
10066
+ }
10067
+ return response;
10068
+ }
10069
+ async signals(id, params = {}) {
10070
+ this.client._requireAuth();
10071
+ const first = params.first ?? 20;
10072
+ if (!Number.isInteger(first) || first < 1 || first > 50) {
10073
+ throw invalidArgument("first must be an integer between 1 and 50");
10074
+ }
10075
+ if (params.cursor !== void 0 && typeof params.cursor !== "string") {
10076
+ throw invalidArgument("cursor must be a string");
10077
+ }
10078
+ return thesisSignalsResponse(
10079
+ await this.client._request(
10080
+ "GET",
10081
+ `/api/v1/theses/${requireID(id, "id")}/signals`,
10082
+ {
10083
+ query: {
10084
+ first,
10085
+ ...params.cursor === void 0 ? {} : { cursor: params.cursor }
10086
+ }
10087
+ }
10088
+ ),
10089
+ id,
10090
+ first
10091
+ );
10092
+ }
10051
10093
  async update(id, params) {
10052
10094
  this.client._requireAuth();
10053
10095
  const body = updateBody(params);
@@ -10219,6 +10261,112 @@ function thesisGetResponse(response) {
10219
10261
  });
10220
10262
  return { thesis: base.thesis, author, entities };
10221
10263
  }
10264
+ function thesisSignalsResponse(response, thesisID, first) {
10265
+ if (!isRecord2(response) || !isRecord2(response.research) || !Array.isArray(response.entries) || response.entries.length > first) {
10266
+ throw invalidResponse2("invalid Signal history response");
10267
+ }
10268
+ const research = response.research;
10269
+ const status = {
10270
+ state: responseText(research.state, "research.state"),
10271
+ pending_work: responseNonnegativeInteger(
10272
+ research.pending_work,
10273
+ "research.pending_work"
10274
+ ),
10275
+ read_complete: responseBoolean(
10276
+ research.read_complete,
10277
+ "research.read_complete"
10278
+ )
10279
+ };
10280
+ if (research.last_attempt_ms !== void 0)
10281
+ status.last_attempt_ms = responseNonnegativeInteger(
10282
+ research.last_attempt_ms,
10283
+ "research.last_attempt_ms"
10284
+ );
10285
+ if (research.last_completed_ms !== void 0)
10286
+ status.last_completed_ms = responseNonnegativeInteger(
10287
+ research.last_completed_ms,
10288
+ "research.last_completed_ms"
10289
+ );
10290
+ const entries = response.entries.map((raw) => {
10291
+ if (!isRecord2(raw) || !isRecord2(raw.signal) || !isRecord2(raw.signal.source)) {
10292
+ throw invalidResponse2("entry must include a Signal and source");
10293
+ }
10294
+ const signal = raw.signal;
10295
+ const source = signal.source;
10296
+ const signalID = responseID(signal.thesis_id, "signal.thesis_id");
10297
+ if (signalID !== thesisID)
10298
+ throw invalidResponse2("Signal belongs to another Thesis");
10299
+ const cursor = responseNonemptyText(raw.cursor, "entry.cursor");
10300
+ const mappedSource = {
10301
+ title: responseText(source.title, "source.title")
10302
+ };
10303
+ if (source.url !== void 0)
10304
+ mappedSource.url = responseText(source.url, "source.url");
10305
+ if (source.published_at_ms !== void 0)
10306
+ mappedSource.published_at_ms = responseNonnegativeInteger(
10307
+ source.published_at_ms,
10308
+ "source.published_at_ms"
10309
+ );
10310
+ const mappedSignal = {
10311
+ id: responseID(signal.id, "signal.id"),
10312
+ thesis_id: signalID,
10313
+ author_version_id: responseID(
10314
+ signal.author_version_id,
10315
+ "signal.author_version_id"
10316
+ ),
10317
+ statement_snapshot: responseNonemptyText(
10318
+ signal.statement_snapshot,
10319
+ "signal.statement_snapshot"
10320
+ ),
10321
+ stance: responseText(signal.stance, "signal.stance"),
10322
+ explanation: responseText(signal.explanation, "signal.explanation"),
10323
+ information_kind: responseText(
10324
+ signal.information_kind,
10325
+ "signal.information_kind"
10326
+ ),
10327
+ source: mappedSource
10328
+ };
10329
+ if (signal.evidence_excerpt !== void 0) {
10330
+ if (!isRecord2(signal.evidence_excerpt))
10331
+ throw invalidResponse2("invalid evidence excerpt");
10332
+ mappedSignal.evidence_excerpt = {
10333
+ text: responseNonemptyText(
10334
+ signal.evidence_excerpt.text,
10335
+ "evidence_excerpt.text"
10336
+ ),
10337
+ omitted_before: responseBoolean(
10338
+ signal.evidence_excerpt.omitted_before,
10339
+ "evidence_excerpt.omitted_before"
10340
+ ),
10341
+ omitted_after: responseBoolean(
10342
+ signal.evidence_excerpt.omitted_after,
10343
+ "evidence_excerpt.omitted_after"
10344
+ )
10345
+ };
10346
+ }
10347
+ return {
10348
+ feed_entry_id: responseID(raw.feed_entry_id, "feed_entry_id"),
10349
+ cursor,
10350
+ signal: mappedSignal
10351
+ };
10352
+ });
10353
+ const nextCursor = responseText(response.next_cursor, "next_cursor");
10354
+ if (nextCursor && nextCursor !== entries[entries.length - 1]?.cursor) {
10355
+ throw invalidResponse2("next_cursor must match the final entry");
10356
+ }
10357
+ return { research: status, entries, next_cursor: nextCursor };
10358
+ }
10359
+ function responseNonnegativeInteger(value, field) {
10360
+ if (typeof value !== "number" || !Number.isSafeInteger(value) || value < 0) {
10361
+ throw invalidResponse2(field + " must be a nonnegative safe integer");
10362
+ }
10363
+ return value;
10364
+ }
10365
+ function responseNonemptyText(value, field) {
10366
+ const valueText = responseText(value, field);
10367
+ if (!valueText.trim()) throw invalidResponse2(field + " must be nonempty");
10368
+ return valueText;
10369
+ }
10222
10370
  function requireRequestID(value) {
10223
10371
  if (!UUID.test(value) || /^0{8}-0{4}-0{4}-0{4}-0{12}$/i.test(value)) {
10224
10372
  throw invalidArgument("request_id must be a non-zero RFC 4122 UUID");
@@ -11061,6 +11209,10 @@ var COMMAND_DEFINITIONS = [
11061
11209
  booleans: ["body-stdin"]
11062
11210
  }),
11063
11211
  command("thesis get", { values: ["id"] }),
11212
+ command("thesis version get", {
11213
+ values: ["id", "author-version-id"]
11214
+ }),
11215
+ command("thesis signals", { values: ["id", "first", "cursor"] }),
11064
11216
  command("thesis set-visibility", { values: ["id", "visibility"] }),
11065
11217
  command("thesis update", {
11066
11218
  values: [
@@ -11215,7 +11367,7 @@ var COMMAND_DEFINITIONS = [
11215
11367
  }),
11216
11368
  command("release playbook", {
11217
11369
  values: ["name", "version", "feeds", "changelog", "readme-url"],
11218
- booleans: ["bypass-lint"]
11370
+ booleans: ["bypass-lint", "confirm-bundled-feed-exposure"]
11219
11371
  }),
11220
11372
  command("lint playbook", {
11221
11373
  values: ["format"],
@@ -15751,7 +15903,7 @@ function formatTradingPairResolved(result) {
15751
15903
  }
15752
15904
 
15753
15905
  // src/cli/dispatch.ts
15754
- var CLI_VERSION = true ? "0.28.1-beta.1" : "dev";
15906
+ var CLI_VERSION = true ? "0.29.0" : "dev";
15755
15907
  var DEFAULT_RUN_TIMEOUT_MS = 6e5;
15756
15908
  var RUN_TIMEOUT_ENV = "ALVA_RUN_TIMEOUT_MS";
15757
15909
  var GLOBAL_VALUE_FLAGS = Object.entries(GLOBAL_FLAG_DEFINITIONS).filter(([, kind]) => kind === "value").map(([name]) => `--${name}`);
@@ -15795,7 +15947,7 @@ Commands:
15795
15947
  deploy Cronjob management (create, list, get, update, delete, pause, resume, runs, run-logs)
15796
15948
  schedule Agent-owned named schedules (list, put, pause, resume, delete)
15797
15949
  steward Push steward reports for a Session Inbox (decide, forward, send, pending, briefed)
15798
- thesis Authored thesis lifecycle (create, get, set-visibility, update, close, delete, rewrite)
15950
+ thesis Authored thesis lifecycle (create, get, signals, set-visibility, update, close, delete, rewrite)
15799
15951
  service-account Restricted run-as identities (create, list, delete, grant, revoke)
15800
15952
  release Feed and playbook releases (feed, playbook-draft, playbook)
15801
15953
  lint Design-system lint (playbook)
@@ -16628,6 +16780,9 @@ Playbook-draft flags:
16628
16780
  with skill tags; re-draft replaces the tag set.
16629
16781
 
16630
16782
  Playbook flags:
16783
+ --confirm-bundled-feed-exposure
16784
+ Confirm delivery of bundled non-public Feeds to
16785
+ the Playbook audience. Defaults to unconfirmed.
16631
16786
  --name <name> Playbook name, must already exist as draft (required)
16632
16787
  --version <version> Semantic version, e.g. "v1.0.0" (required)
16633
16788
  --feeds <json> JSON array of {feed_id, feed_major?} (required)
@@ -17120,13 +17275,15 @@ Examples:
17120
17275
  alva arrays token status`,
17121
17276
  thesis: `Usage: alva thesis <subcommand> [options]
17122
17277
 
17123
- Create, read, update, close, delete, or explicitly rewrite an authored thesis.
17278
+ Create, read, inspect Signals and exact author versions, update, close, delete, or explicitly rewrite an authored thesis.
17124
17279
  Backend owns Signal/Alert setup; the CLI never starts them separately.
17125
17280
  Create and update never rewrite text automatically.
17126
17281
 
17127
17282
  Subcommands:
17128
17283
  create Create a thesis
17129
17284
  get Get one thesis
17285
+ version get Get one exact author version
17286
+ signals Read published Signal history
17130
17287
  set-visibility Change current access without publishing a version
17131
17288
  update Replaces document fields: body, title, entities, visibility (all sent in full)
17132
17289
  close Close the current author version with an optional note
@@ -17147,6 +17304,8 @@ Update requires --visibility explicitly so it cannot inadvertently publish.
17147
17304
  Other flags:
17148
17305
  create --request-id <uuid> --body ... [--title <text>] [--tickers <ticker,ticker>] [--entity-ids <id,id>] [--visibility <value>]
17149
17306
  get --id <signed-int64-decimal>
17307
+ version get --id <signed-int64-decimal> --author-version-id <signed-int64-decimal>
17308
+ signals --id <id> [--first <1-50>] [--cursor <opaque-cursor>]
17150
17309
  set-visibility --id <id> --visibility public|private
17151
17310
  update --id <id> --request-id <uuid> --expected-author-version-id <id> --body ... --visibility <value> [--title <text>] [--entity-ids <id,id>] [--editorial]
17152
17311
  close --id <id> --expected-author-version-id <id> [--note <text>]
@@ -18469,6 +18628,19 @@ async function executeParsedCommand(client, parsedCommand, meta, deps) {
18469
18628
  });
18470
18629
  case "get":
18471
18630
  return client.theses.get(requireFlag(flags, "id", "thesis get"));
18631
+ case "version":
18632
+ return client.theses.getVersion(
18633
+ requireFlag(flags, "id", "thesis version get"),
18634
+ requireFlag(flags, "author-version-id", "thesis version get")
18635
+ );
18636
+ case "signals":
18637
+ return client.theses.signals(
18638
+ requireFlag(flags, "id", "thesis signals"),
18639
+ {
18640
+ first: flags.first === void 0 ? void 0 : Number(flags.first),
18641
+ cursor: flags.cursor
18642
+ }
18643
+ );
18472
18644
  case "set-visibility":
18473
18645
  return client.theses.setVisibility(
18474
18646
  requireFlag(flags, "id", "thesis set-visibility"),
@@ -18999,7 +19171,10 @@ async function executeParsedCommand(client, parsedCommand, meta, deps) {
18999
19171
  version,
19000
19172
  feeds: jsonParse(feedsRaw),
19001
19173
  changelog,
19002
- readme_url: readmeUrl
19174
+ readme_url: readmeUrl,
19175
+ confirm_bundled_feed_exposure: boolFlag(
19176
+ flags["confirm-bundled-feed-exposure"]
19177
+ )
19003
19178
  });
19004
19179
  }
19005
19180
  default: