exponential-sdk 1.21.0 → 1.24.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/index.js CHANGED
@@ -643,11 +643,21 @@ var DecisionsApi = class {
643
643
  linkId
644
644
  });
645
645
  }
646
- /** Publish a draft into the log. */
647
- async confirmDraft(workspaceId, decisionId) {
646
+ /**
647
+ * Publish a draft into the log. Needs a person's login: agent keys are
648
+ * refused. Idempotent on a decision that is already confirmed.
649
+ *
650
+ * `status` moves it in the same write — `{ status: 'ACCEPTED' }` is
651
+ * "confirm as accepted", and works on an already-confirmed decision too.
652
+ * `SUPERSEDED` is refused (it needs a successor; use {@link setStatus}).
653
+ * A person confirming or accepting a decision that no person stands behind
654
+ * becomes its decider. `decisionId` may also be a `D-0006` label.
655
+ */
656
+ async confirmDraft(workspaceId, decisionId, options = {}) {
648
657
  return await this.client.decision.confirmDraft.mutate({
649
658
  workspaceId,
650
- decisionId
659
+ decisionId,
660
+ ...options.status ? { status: options.status } : {}
651
661
  });
652
662
  }
653
663
  /**
@@ -1076,8 +1086,25 @@ var PagesApi = class {
1076
1086
  async list(options) {
1077
1087
  return await this.client.page.list.query(options);
1078
1088
  }
1079
- async get(id) {
1080
- return await this.client.page.get.query({ id });
1089
+ /** One page. Markdown body only unless `format` says otherwise. */
1090
+ async get(id, options = {}) {
1091
+ return await this.client.page.get.query({
1092
+ id,
1093
+ format: options.format ?? "markdown",
1094
+ ...options.section ? { section: options.section } : {}
1095
+ });
1096
+ }
1097
+ /** The page's headings (level, text, line) and `bodyBytes`, no body. */
1098
+ async outline(id) {
1099
+ return await this.get(id, { format: "outline" });
1100
+ }
1101
+ /**
1102
+ * Pages about something: semantic hits from the Knowledge index first
1103
+ * (nearest first, with the matching passage as `snippet`), then pages whose
1104
+ * title or body contain the query. Only pages the caller can view.
1105
+ */
1106
+ async search(options) {
1107
+ return await this.client.page.search.query(options);
1081
1108
  }
1082
1109
  async create(input) {
1083
1110
  return await this.client.page.create.mutate(input);
@@ -1085,7 +1112,69 @@ var PagesApi = class {
1085
1112
  async update(input) {
1086
1113
  return await this.client.page.update.mutate(input);
1087
1114
  }
1115
+ /** The page's revisions, newest first — who, when, why, size. Never the bodies. */
1116
+ async history(id, options = {}) {
1117
+ return await this.client.page.history.query({ id, ...options });
1118
+ }
1119
+ /** One revision with its Markdown body. */
1120
+ async revision(pageId, revisionId) {
1121
+ return await this.client.page.revision.query({ id: pageId, revisionId });
1122
+ }
1123
+ /** What a revision changed, as a unified diff of the Markdown. */
1124
+ async diff(pageId, revisionId, options = {}) {
1125
+ return await this.client.page.diff.query({
1126
+ id: pageId,
1127
+ revisionId,
1128
+ against: options.against ?? "previous"
1129
+ });
1130
+ }
1131
+ /**
1132
+ * Put a revision's content back as the page's current content. A forward
1133
+ * write: `docVersion` bumps and a "restore" revision is recorded.
1134
+ */
1135
+ async restore(pageId, revisionId, options = {}) {
1136
+ return await this.client.page.restore.mutate({ id: pageId, revisionId, ...options });
1137
+ }
1138
+ };
1139
+
1140
+ // src/resources.ts
1141
+ var ResourcesApi = class {
1142
+ constructor(client) {
1143
+ this.client = client;
1144
+ }
1145
+ async list(options = {}) {
1146
+ return await this.client.resource.list.query(options);
1147
+ }
1148
+ async create(input) {
1149
+ const result = await this.client.resource.create.mutate(input);
1150
+ return result.resource;
1151
+ }
1152
+ /** Save a link to the Reading list: a `bookmark` in `to_read`, not embedded. */
1153
+ async save(input) {
1154
+ return await this.create({
1155
+ title: input.title?.trim() || hostnameOf(input.url) || input.url,
1156
+ url: input.url,
1157
+ description: input.note,
1158
+ contentType: "bookmark",
1159
+ readStatus: input.readStatus ?? "to_read",
1160
+ generateEmbeddings: false,
1161
+ workspaceId: input.workspaceId
1162
+ });
1163
+ }
1164
+ async setReadStatus(id, readStatus) {
1165
+ return await this.client.resource.setReadStatus.mutate({ id, readStatus });
1166
+ }
1167
+ async archive(id) {
1168
+ return await this.client.resource.archive.mutate({ id });
1169
+ }
1088
1170
  };
1171
+ function hostnameOf(url) {
1172
+ try {
1173
+ return new URL(url).hostname.replace(/^www\./, "");
1174
+ } catch {
1175
+ return null;
1176
+ }
1177
+ }
1089
1178
 
1090
1179
  // src/requirements.ts
1091
1180
  var RequirementsApi = class {
@@ -1154,11 +1243,21 @@ var SearchApi = class {
1154
1243
  /**
1155
1244
  * Global text search across the entities the caller can access — the same
1156
1245
  * coverage as the app's Cmd+K palette (projects, actions, goals,
1157
- * workspaces, and other entity types as the API grows).
1246
+ * workspaces, and other entity types as the API grows). Matches titles;
1247
+ * for pages by meaning use `knowledge` or `PagesApi.search`.
1158
1248
  */
1159
1249
  async global(options) {
1160
1250
  return await this.client.search.global.query(options);
1161
1251
  }
1252
+ /**
1253
+ * Semantic search over one workspace's Knowledge index — the caller's own
1254
+ * indexed meetings, resources, documents and pages, scored by meaning. Each
1255
+ * source contributes its best-matching passage. Costs an embedding call;
1256
+ * never throws for an index failure (returns no results instead).
1257
+ */
1258
+ async knowledge(options) {
1259
+ return await this.client.search.knowledge.query(options);
1260
+ }
1162
1261
  };
1163
1262
 
1164
1263
  // src/time.ts
@@ -1449,6 +1548,7 @@ var ExponentialClient = class {
1449
1548
  this.areas = new AreasApi(this.client);
1450
1549
  this.meetings = new MeetingsApi(this.client);
1451
1550
  this.pages = new PagesApi(this.client);
1551
+ this.resources = new ResourcesApi(this.client);
1452
1552
  this.requirements = new RequirementsApi(this.client);
1453
1553
  this.scopes = new ScopesApi(this.client);
1454
1554
  this.search = new SearchApi(this.client);
@@ -1479,6 +1579,7 @@ var ExponentialClient = class {
1479
1579
  areas;
1480
1580
  meetings;
1481
1581
  pages;
1582
+ resources;
1482
1583
  requirements;
1483
1584
  scopes;
1484
1585
  search;