@aithos/sdk 0.1.0-alpha.20 → 0.1.0-alpha.21

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.
@@ -85,6 +85,53 @@ export declare class EthosZone {
85
85
  addSection(input: AddSectionInput): void;
86
86
  updateSection(sectionId: string, patch: UpdateSectionPatch): void;
87
87
  deleteSection(sectionId: string): void;
88
+ /**
89
+ * Return every section in this zone whose `title` is exactly `title`.
90
+ *
91
+ * Match is exact and case-sensitive. The result is always an array — it
92
+ * may be empty (no match), have one element (the typical case), or have
93
+ * more than one element when the author has happened to publish two
94
+ * sections with the same title. Section titles are not required by the
95
+ * protocol to be unique within a zone.
96
+ *
97
+ * The order of returned sections is the zone's authored order
98
+ * (`sections()` ordering, spec §2.5.2).
99
+ *
100
+ * @param title Section title to look up — exact, case-sensitive.
101
+ */
102
+ findSectionsByTitle(title: string): Promise<readonly Section[]>;
103
+ /**
104
+ * Stage an update for **every** section in this zone whose `title`
105
+ * matches `title` exactly. Returns the list of section IDs that were
106
+ * staged — empty when nothing matched.
107
+ *
108
+ * Apply with `client.publish()` like any other staged mutation. The
109
+ * staged entries are identical to what `updateSection(id, patch)` would
110
+ * produce, one per matched section, so `pendingChanges()` /
111
+ * `discard()` behave normally.
112
+ *
113
+ * Note: this method does NOT throw when there is no match — it returns
114
+ * `[]`. That's intentional: callers driven by an LLM frequently want to
115
+ * upsert (try update, then fall back to add) and shouldn't have to
116
+ * catch.
117
+ *
118
+ * @param title Section title to look up — exact, case-sensitive.
119
+ * @param patch Same patch shape accepted by `updateSection`.
120
+ * @returns Array of `section.id` strings whose updates were staged.
121
+ */
122
+ updateSectionsByTitle(title: string, patch: UpdateSectionPatch): Promise<readonly string[]>;
123
+ /**
124
+ * Stage a delete for **every** section in this zone whose `title`
125
+ * matches `title` exactly. Returns the list of section IDs that were
126
+ * staged — empty when nothing matched.
127
+ *
128
+ * Same semantics as {@link updateSectionsByTitle}: silent on no-match,
129
+ * apply with `client.publish()`.
130
+ *
131
+ * @param title Section title to look up — exact, case-sensitive.
132
+ * @returns Array of `section.id` strings whose deletes were staged.
133
+ */
134
+ deleteSectionsByTitle(title: string): Promise<readonly string[]>;
88
135
  }
89
136
  export interface EthosNamespaceDeps {
90
137
  readonly auth: AithosAuth;
package/dist/src/ethos.js CHANGED
@@ -517,6 +517,89 @@ export class EthosZone {
517
517
  deleteSection(sectionId) {
518
518
  this.#parent._stageDelete(this.#name, sectionId);
519
519
  }
520
+ /* ------------------------------------------------------------------------ */
521
+ /* By-title helpers */
522
+ /* */
523
+ /* The Aithos protocol does not (yet) treat section titles as a queryable */
524
+ /* index — only `section.id` is a normative anchor. These three methods */
525
+ /* are an ergonomic SDK-side affordance for the common LLM-driven case */
526
+ /* "act on the section called X". They resolve titles client-side by */
527
+ /* loading the full zone (`sections()`) and exact-match filtering on */
528
+ /* `Section.title`. */
529
+ /* */
530
+ /* When a future revision of `aithos.get_ethos_zone` (or a new */
531
+ /* `aithos.find_sections` primitive) supports server-side title */
532
+ /* filtering, the implementation behind these three methods can swap to */
533
+ /* the server call without changing the public signatures here. The */
534
+ /* contract — async, exact case-sensitive match, plural semantics — is */
535
+ /* intentionally aligned with what such an API would return. */
536
+ /* ------------------------------------------------------------------------ */
537
+ /**
538
+ * Return every section in this zone whose `title` is exactly `title`.
539
+ *
540
+ * Match is exact and case-sensitive. The result is always an array — it
541
+ * may be empty (no match), have one element (the typical case), or have
542
+ * more than one element when the author has happened to publish two
543
+ * sections with the same title. Section titles are not required by the
544
+ * protocol to be unique within a zone.
545
+ *
546
+ * The order of returned sections is the zone's authored order
547
+ * (`sections()` ordering, spec §2.5.2).
548
+ *
549
+ * @param title Section title to look up — exact, case-sensitive.
550
+ */
551
+ async findSectionsByTitle(title) {
552
+ const all = await this.#parent._readZone(this.#name);
553
+ return all.filter((s) => s.title === title);
554
+ }
555
+ /**
556
+ * Stage an update for **every** section in this zone whose `title`
557
+ * matches `title` exactly. Returns the list of section IDs that were
558
+ * staged — empty when nothing matched.
559
+ *
560
+ * Apply with `client.publish()` like any other staged mutation. The
561
+ * staged entries are identical to what `updateSection(id, patch)` would
562
+ * produce, one per matched section, so `pendingChanges()` /
563
+ * `discard()` behave normally.
564
+ *
565
+ * Note: this method does NOT throw when there is no match — it returns
566
+ * `[]`. That's intentional: callers driven by an LLM frequently want to
567
+ * upsert (try update, then fall back to add) and shouldn't have to
568
+ * catch.
569
+ *
570
+ * @param title Section title to look up — exact, case-sensitive.
571
+ * @param patch Same patch shape accepted by `updateSection`.
572
+ * @returns Array of `section.id` strings whose updates were staged.
573
+ */
574
+ async updateSectionsByTitle(title, patch) {
575
+ const matches = await this.findSectionsByTitle(title);
576
+ const ids = [];
577
+ for (const s of matches) {
578
+ this.#parent._stageUpdate(this.#name, s.id, patch);
579
+ ids.push(s.id);
580
+ }
581
+ return ids;
582
+ }
583
+ /**
584
+ * Stage a delete for **every** section in this zone whose `title`
585
+ * matches `title` exactly. Returns the list of section IDs that were
586
+ * staged — empty when nothing matched.
587
+ *
588
+ * Same semantics as {@link updateSectionsByTitle}: silent on no-match,
589
+ * apply with `client.publish()`.
590
+ *
591
+ * @param title Section title to look up — exact, case-sensitive.
592
+ * @returns Array of `section.id` strings whose deletes were staged.
593
+ */
594
+ async deleteSectionsByTitle(title) {
595
+ const matches = await this.findSectionsByTitle(title);
596
+ const ids = [];
597
+ for (const s of matches) {
598
+ this.#parent._stageDelete(this.#name, s.id);
599
+ ids.push(s.id);
600
+ }
601
+ return ids;
602
+ }
520
603
  }
521
604
  export class EthosNamespace {
522
605
  #deps;
@@ -1,4 +1,4 @@
1
- export declare const VERSION = "0.1.0-alpha.19";
1
+ export declare const VERSION = "0.1.0-alpha.21";
2
2
  export { AithosSDK } from "./sdk.js";
3
3
  export type { AithosSDKConfig } from "./types.js";
4
4
  export { AithosSDKError } from "./types.js";
package/dist/src/index.js CHANGED
@@ -17,7 +17,7 @@
17
17
  // Public types specific to the SDK (`AithosSDKConfig`, `AithosSDKError`)
18
18
  // are exported from here. Endpoint config (`AithosSdkEndpoints`,
19
19
  // `DEFAULT_SDK_ENDPOINTS`) likewise.
20
- export const VERSION = "0.1.0-alpha.19";
20
+ export const VERSION = "0.1.0-alpha.21";
21
21
  export { AithosSDK } from "./sdk.js";
22
22
  export { AithosSDKError } from "./types.js";
23
23
  // Re-export protocol-client's JSON-RPC error type so consumers can
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aithos/sdk",
3
- "version": "0.1.0-alpha.20",
3
+ "version": "0.1.0-alpha.21",
4
4
  "description": "Aithos SDK — high-level TypeScript developer kit for building agentic apps on the Aithos protocol. Wraps @aithos/protocol-client and exposes the Aithos compute proxy and wallet (Stripe top-up) endpoints.",
5
5
  "keywords": [
6
6
  "aithos",