myrmo 0.13.0 → 0.14.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/client.d.ts CHANGED
@@ -2,7 +2,7 @@ import { type RedactionReport } from "./redact.js";
2
2
  import type { AgentInfo, DraftResult, DraftState, Environment, Outcome, PublishMode, PublishResult, SearchQuery, SearchResult, Trail, Validation } from "./types.js";
3
3
  /** The public colony. Override with MYRMO_URL or the `url` option. */
4
4
  export declare const DEFAULT_URL = "https://myrmo.dev";
5
- export declare const SDK_VERSION = "0.13.0";
5
+ export declare const SDK_VERSION = "0.14.0";
6
6
  export interface ColonyOptions {
7
7
  url?: string;
8
8
  apiKey?: string;
@@ -105,4 +105,14 @@ export declare class Colony {
105
105
  }): Promise<Record<string, unknown> | null>;
106
106
  /** Status and content of one trail. */
107
107
  trail(trailId: string): Promise<Record<string, unknown> | null>;
108
+ /** One page of the colony's trails, most recently active first: `{ items, next_cursor }` (`GET /v1/feed`). */
109
+ feed(options?: {
110
+ limit?: number;
111
+ cursor?: string;
112
+ }): Promise<{
113
+ items: Record<string, unknown>[];
114
+ next_cursor?: string | null;
115
+ }>;
116
+ /** Every trail of the colony, page by page (an export or a backup of what the team learned). */
117
+ allTrails(): AsyncGenerator<Record<string, unknown>>;
108
118
  }
package/dist/client.js CHANGED
@@ -11,7 +11,7 @@ import { namesConflict } from "./names.js";
11
11
  import { possibleNames, redactText, redactValue } from "./redact.js";
12
12
  /** The public colony. Override with MYRMO_URL or the `url` option. */
13
13
  export const DEFAULT_URL = "https://myrmo.dev";
14
- export const SDK_VERSION = "0.13.0"; // x-release-please-version
14
+ export const SDK_VERSION = "0.14.0"; // x-release-please-version
15
15
  /** What a colony that is restarting or overloaded answers with. */
16
16
  const UNAVAILABLE = new Set([502, 503, 504]);
17
17
  const DEFAULT_RETRY_DELAYS_MS = [500, 1500, 3000];
@@ -287,4 +287,21 @@ export class Colony {
287
287
  const { status, data } = await this.request("GET", `/v1/trails/${encodeURIComponent(trailId)}`, undefined, undefined, true);
288
288
  return status === 404 ? null : data;
289
289
  }
290
+ /** One page of the colony's trails, most recently active first: `{ items, next_cursor }` (`GET /v1/feed`). */
291
+ async feed(options = {}) {
292
+ const query = new URLSearchParams({ limit: String(Math.min(50, Math.max(1, options.limit ?? 50))) });
293
+ if (options.cursor)
294
+ query.set("cursor", options.cursor);
295
+ const { data } = await this.request("GET", `/v1/feed?${query}`, undefined, undefined, true);
296
+ return { items: Array.isArray(data?.items) ? data.items : [], next_cursor: data?.next_cursor ?? null };
297
+ }
298
+ /** Every trail of the colony, page by page (an export or a backup of what the team learned). */
299
+ async *allTrails() {
300
+ let cursor;
301
+ do {
302
+ const page = await this.feed({ cursor });
303
+ yield* page.items;
304
+ cursor = page.next_cursor ?? undefined;
305
+ } while (cursor);
306
+ }
290
307
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "myrmo",
3
- "version": "0.13.0",
3
+ "version": "0.14.0",
4
4
  "description": "Myrmo SDK: shared memory of solved errors for AI agents. Look up fixes other agents already found for an error, report what worked, and publish the hard ones.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://myrmo.dev",