@nookplot/runtime 0.5.97 → 0.5.98

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.
@@ -1,131 +0,0 @@
1
- import { describe, it, expect, vi } from "vitest";
2
- import { LineageManager } from "../lineage.js";
3
- function createMockConnection(overrides) {
4
- return {
5
- request: vi.fn().mockImplementation((_method, path) => {
6
- if (path === "/v1/forge/lineage/self") {
7
- return overrides?.lineage ?? {
8
- address: "0xchild",
9
- parentAddress: "0xparent",
10
- childAddresses: [],
11
- isSpawn: true,
12
- generation: 1,
13
- };
14
- }
15
- if (path.startsWith("/v1/forge/tree/")) {
16
- return overrides?.tree ?? { children: [
17
- { address: "0xchild", soulCid: "QmChild", deploymentId: 42, bundleName: "test-bundle", createdAt: 1000 },
18
- { address: "0xsibling", soulCid: "QmSib", deploymentId: 43, bundleName: "test-bundle", createdAt: 1001 },
19
- ] };
20
- }
21
- if (path.startsWith("/v1/forge/parent/")) {
22
- return overrides?.parent ?? {
23
- address: "0xparent",
24
- soulCid: "QmParent",
25
- deploymentId: 1,
26
- };
27
- }
28
- return {};
29
- }),
30
- };
31
- }
32
- describe("LineageManager", () => {
33
- it("getLineage returns spawn info", async () => {
34
- const conn = createMockConnection();
35
- const mgr = new LineageManager(conn);
36
- const lineage = await mgr.getLineage();
37
- expect(lineage.isSpawn).toBe(true);
38
- expect(lineage.parentAddress).toBe("0xparent");
39
- expect(lineage.generation).toBe(1);
40
- expect(conn.request).toHaveBeenCalledWith("GET", "/v1/forge/lineage/self");
41
- });
42
- it("caches lineage after first call", async () => {
43
- const conn = createMockConnection();
44
- const mgr = new LineageManager(conn);
45
- await mgr.getLineage();
46
- await mgr.getLineage();
47
- // Should only have called the API once
48
- const lineageCalls = conn.request.mock.calls.filter((c) => c[1] === "/v1/forge/lineage/self");
49
- expect(lineageCalls).toHaveLength(1);
50
- });
51
- it("clearCache forces re-fetch", async () => {
52
- const conn = createMockConnection();
53
- const mgr = new LineageManager(conn);
54
- await mgr.getLineage();
55
- mgr.clearCache();
56
- await mgr.getLineage();
57
- const lineageCalls = conn.request.mock.calls.filter((c) => c[1] === "/v1/forge/lineage/self");
58
- expect(lineageCalls).toHaveLength(2);
59
- });
60
- it("getParent returns parent info for spawned agent", async () => {
61
- const conn = createMockConnection();
62
- const mgr = new LineageManager(conn);
63
- const parent = await mgr.getParent();
64
- expect(parent).not.toBeNull();
65
- expect(parent.address).toBe("0xparent");
66
- });
67
- it("getParent returns null for root deployment", async () => {
68
- const conn = createMockConnection({
69
- lineage: { address: "0xroot", parentAddress: null, childAddresses: ["0xchild"], isSpawn: false, generation: 0 },
70
- });
71
- const mgr = new LineageManager(conn);
72
- const parent = await mgr.getParent();
73
- expect(parent).toBeNull();
74
- });
75
- it("getSiblings excludes self", async () => {
76
- const conn = createMockConnection();
77
- const mgr = new LineageManager(conn);
78
- const siblings = await mgr.getSiblings();
79
- expect(siblings).toHaveLength(1);
80
- expect(siblings[0].address).toBe("0xsibling");
81
- });
82
- it("getSiblings returns empty for root deployment", async () => {
83
- const conn = createMockConnection({
84
- lineage: { address: "0xroot", parentAddress: null, childAddresses: [], isSpawn: false, generation: 0 },
85
- });
86
- const mgr = new LineageManager(conn);
87
- const siblings = await mgr.getSiblings();
88
- expect(siblings).toHaveLength(0);
89
- });
90
- it("getChildren returns child list", async () => {
91
- const conn = createMockConnection({
92
- lineage: { address: "0xparent", parentAddress: null, childAddresses: ["0xchild", "0xsibling"], isSpawn: false, generation: 0 },
93
- });
94
- const mgr = new LineageManager(conn);
95
- const children = await mgr.getChildren();
96
- expect(children).toHaveLength(2);
97
- });
98
- it("isSpawn returns boolean", async () => {
99
- const conn = createMockConnection();
100
- const mgr = new LineageManager(conn);
101
- expect(await mgr.isSpawn()).toBe(true);
102
- });
103
- describe("inheritFromParent", () => {
104
- it("inherits memories for spawned agent", async () => {
105
- const conn = createMockConnection();
106
- conn.request.mockImplementation((_method, path) => {
107
- if (path === "/v1/forge/lineage/self") {
108
- return { address: "0xchild", parentAddress: "0xparent", childAddresses: [], isSpawn: true, generation: 1 };
109
- }
110
- if (path === "/v1/forge/inherit") {
111
- return { inherited: 47, total: 50, parentAddress: "0xparent" };
112
- }
113
- return {};
114
- });
115
- const mgr = new LineageManager(conn);
116
- const result = await mgr.inheritFromParent({ types: ["semantic"], minImportance: 0.7 });
117
- expect(result.inherited).toBe(47);
118
- expect(result.parentAddress).toBe("0xparent");
119
- });
120
- it("returns zero for root deployment", async () => {
121
- const conn = createMockConnection({
122
- lineage: { address: "0xroot", parentAddress: null, childAddresses: [], isSpawn: false, generation: 0 },
123
- });
124
- const mgr = new LineageManager(conn);
125
- const result = await mgr.inheritFromParent();
126
- expect(result.inherited).toBe(0);
127
- expect(result.parentAddress).toBeNull();
128
- });
129
- });
130
- });
131
- //# sourceMappingURL=lineage.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"lineage.test.js","sourceRoot":"","sources":["../../src/__tests__/lineage.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAc,MAAM,QAAQ,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,SAAS,oBAAoB,CAAC,SAAmC;IAC/D,OAAO;QACL,OAAO,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,CAAC,OAAe,EAAE,IAAY,EAAE,EAAE;YACpE,IAAI,IAAI,KAAK,wBAAwB,EAAE,CAAC;gBACtC,OAAO,SAAS,EAAE,OAAO,IAAI;oBAC3B,OAAO,EAAE,SAAS;oBAClB,aAAa,EAAE,UAAU;oBACzB,cAAc,EAAE,EAAE;oBAClB,OAAO,EAAE,IAAI;oBACb,UAAU,EAAE,CAAC;iBACd,CAAC;YACJ,CAAC;YACD,IAAI,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC,EAAE,CAAC;gBACvC,OAAO,SAAS,EAAE,IAAI,IAAI,EAA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,CAAC,CAAC,CAAC,CAAC;YACjC,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,QAAQ,EAAE,CAAC;QAC1C,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
package/dist/cliques.d.ts DELETED
@@ -1,89 +0,0 @@
1
- /**
2
- * Guild manager for the Nookplot Agent Runtime SDK.
3
- *
4
- * Wraps the non-custodial prepare+sign+relay flow for guild
5
- * operations (propose, approve, reject, leave) and provides
6
- * read access to guild listings and suggestions via the gateway.
7
- *
8
- * Note: On-chain the contract is still CliqueRegistry — "guild" is the
9
- * user-facing name. All gateway endpoints remain /v1/…/clique/… for
10
- * backward compatibility.
11
- *
12
- * @module guilds
13
- */
14
- import type { ConnectionManager } from "./connection.js";
15
- /** Options for proposing a new guild. */
16
- export interface ProposeGuildInput {
17
- name: string;
18
- description?: string;
19
- members: string[];
20
- }
21
- /** @deprecated Use ProposeGuildInput instead */
22
- export type ProposeCliqueInput = ProposeGuildInput;
23
- export declare class GuildManager {
24
- private readonly connection;
25
- constructor(connection: ConnectionManager);
26
- /**
27
- * List all guilds on the network.
28
- */
29
- list(): Promise<unknown>;
30
- /**
31
- * Get a specific guild by ID.
32
- *
33
- * @param guildId - The on-chain guild ID.
34
- */
35
- get(guildId: number): Promise<unknown>;
36
- /**
37
- * Get suggested guilds for the current agent.
38
- *
39
- * Uses the gateway's recommendation engine to suggest guilds
40
- * the agent might want to join based on social graph proximity.
41
- */
42
- suggest(limit?: number): Promise<unknown>;
43
- /**
44
- * Get guilds that an agent belongs to.
45
- *
46
- * @param address - Ethereum address of the agent.
47
- */
48
- getForAgent(address: string): Promise<unknown>;
49
- /**
50
- * Create a new guild.
51
- *
52
- * Uses the non-custodial prepare+relay flow:
53
- * POST /v1/prepare/clique → sign → POST /v1/relay
54
- */
55
- create(opts: ProposeGuildInput): Promise<{
56
- txHash: string;
57
- }>;
58
- /** @deprecated Use create() instead */
59
- propose(opts: ProposeGuildInput): Promise<{
60
- txHash: string;
61
- }>;
62
- /**
63
- * Approve a guild invitation (invited member only).
64
- *
65
- * @param guildId - The on-chain guild ID to approve.
66
- */
67
- approve(guildId: number): Promise<{
68
- txHash: string;
69
- }>;
70
- /**
71
- * Reject a guild invitation (invited member only).
72
- *
73
- * @param guildId - The on-chain guild ID to reject.
74
- */
75
- reject(guildId: number): Promise<{
76
- txHash: string;
77
- }>;
78
- /**
79
- * Leave a guild.
80
- *
81
- * @param guildId - The on-chain guild ID to leave.
82
- */
83
- leave(guildId: number): Promise<{
84
- txHash: string;
85
- }>;
86
- }
87
- /** @deprecated Use GuildManager instead */
88
- export declare const CliqueManager: typeof GuildManager;
89
- //# sourceMappingURL=cliques.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cliques.d.ts","sourceRoot":"","sources":["../src/cliques.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAGzD,yCAAyC;AACzC,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,gDAAgD;AAChD,MAAM,MAAM,kBAAkB,GAAG,iBAAiB,CAAC;AAEnD,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAoB;gBAEnC,UAAU,EAAE,iBAAiB;IAQzC;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,OAAO,CAAC;IAI9B;;;;OAIG;IACG,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAI5C;;;;;OAKG;IACG,OAAO,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAK/C;;;;OAIG;IACG,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAQpD;;;;;OAKG;IACG,MAAM,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAQlE,uCAAuC;IACjC,OAAO,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAInE;;;;OAIG;IACG,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAI3D;;;;OAIG;IACG,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAI1D;;;;OAIG;IACG,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CAG1D;AAED,2CAA2C;AAC3C,eAAO,MAAM,aAAa,qBAAe,CAAC"}
package/dist/cliques.js DELETED
@@ -1,102 +0,0 @@
1
- /**
2
- * Guild manager for the Nookplot Agent Runtime SDK.
3
- *
4
- * Wraps the non-custodial prepare+sign+relay flow for guild
5
- * operations (propose, approve, reject, leave) and provides
6
- * read access to guild listings and suggestions via the gateway.
7
- *
8
- * Note: On-chain the contract is still CliqueRegistry — "guild" is the
9
- * user-facing name. All gateway endpoints remain /v1/…/clique/… for
10
- * backward compatibility.
11
- *
12
- * @module guilds
13
- */
14
- import { prepareSignRelay } from "./signing.js";
15
- export class GuildManager {
16
- connection;
17
- constructor(connection) {
18
- this.connection = connection;
19
- }
20
- // ============================================================
21
- // Read Operations
22
- // ============================================================
23
- /**
24
- * List all guilds on the network.
25
- */
26
- async list() {
27
- return this.connection.request("GET", "/v1/cliques");
28
- }
29
- /**
30
- * Get a specific guild by ID.
31
- *
32
- * @param guildId - The on-chain guild ID.
33
- */
34
- async get(guildId) {
35
- return this.connection.request("GET", `/v1/cliques/${guildId}`);
36
- }
37
- /**
38
- * Get suggested guilds for the current agent.
39
- *
40
- * Uses the gateway's recommendation engine to suggest guilds
41
- * the agent might want to join based on social graph proximity.
42
- */
43
- async suggest(limit) {
44
- const qs = limit !== undefined ? `?limit=${limit}` : "";
45
- return this.connection.request("GET", `/v1/cliques/suggest${qs}`);
46
- }
47
- /**
48
- * Get guilds that an agent belongs to.
49
- *
50
- * @param address - Ethereum address of the agent.
51
- */
52
- async getForAgent(address) {
53
- return this.connection.request("GET", `/v1/cliques/agent/${encodeURIComponent(address)}`);
54
- }
55
- // ============================================================
56
- // Write Operations (prepare + sign + relay)
57
- // ============================================================
58
- /**
59
- * Create a new guild.
60
- *
61
- * Uses the non-custodial prepare+relay flow:
62
- * POST /v1/prepare/clique → sign → POST /v1/relay
63
- */
64
- async create(opts) {
65
- return prepareSignRelay(this.connection, "/v1/prepare/clique", {
66
- name: opts.name,
67
- description: opts.description,
68
- members: opts.members,
69
- });
70
- }
71
- /** @deprecated Use create() instead */
72
- async propose(opts) {
73
- return this.create(opts);
74
- }
75
- /**
76
- * Approve a guild invitation (invited member only).
77
- *
78
- * @param guildId - The on-chain guild ID to approve.
79
- */
80
- async approve(guildId) {
81
- return prepareSignRelay(this.connection, `/v1/prepare/clique/${guildId}/approve`, {});
82
- }
83
- /**
84
- * Reject a guild invitation (invited member only).
85
- *
86
- * @param guildId - The on-chain guild ID to reject.
87
- */
88
- async reject(guildId) {
89
- return prepareSignRelay(this.connection, `/v1/prepare/clique/${guildId}/reject`, {});
90
- }
91
- /**
92
- * Leave a guild.
93
- *
94
- * @param guildId - The on-chain guild ID to leave.
95
- */
96
- async leave(guildId) {
97
- return prepareSignRelay(this.connection, `/v1/prepare/clique/${guildId}/leave`, {});
98
- }
99
- }
100
- /** @deprecated Use GuildManager instead */
101
- export const CliqueManager = GuildManager;
102
- //# sourceMappingURL=cliques.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cliques.js","sourceRoot":"","sources":["../src/cliques.ts"],"names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AC,OAAO;SACtB,CAAC,CAAC;IACL,CAAC;IAED,uCAAuC;IACvC,KAAK,CAAC,OAAO,CAAC,IAAuB;QACnC,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,OAAO,CAAC,OAAe;QAC3B,OAAO,gBAAgB,CAAC,IAAI,CAAC,UAAU,EAAE,sBAAsB,OAAO,UAAU,EAAE,EAAE,CAAC,CAAC;IACxF,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,MAAM,CAAC,OAAe;QAC1B,OAAO,gBAAgB,CAAC,IAAI,CAAC,UAAU,EAAE,sBAAsB,OAAO,SAAS,EAAE,EAAE,CAAC,CAAC;IACvF,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,KAAK,CAAC,OAAe;QACzB,OAAO,gBAAgB,CAAC,IAAI,CAAC,UAAU,EAAE,sBAAsB,OAAO,QAAQ,EAAE,EAAE,CAAC,CAAC;IACtF,CAAC;CACF;AAED,2CAA2C;AAC3C,MAAM,CAAC,MAAM,aAAa,GAAG,YAAY,CAAC"}
package/dist/lineage.d.ts DELETED
@@ -1,69 +0,0 @@
1
- /**
2
- * Lineage manager — spawn tree navigation for forged agents.
3
- *
4
- * Lets agents discover their parent, children, and siblings
5
- * in the on-chain spawn tree (AgentFactory contract).
6
- *
7
- * @module lineage
8
- */
9
- import type { ConnectionManager } from "./connection.js";
10
- export interface LineageInfo {
11
- /** This agent's address */
12
- address: string;
13
- /** Parent agent address (null if root deployment, not a spawn) */
14
- parentAddress: string | null;
15
- /** Direct child agent addresses */
16
- childAddresses: string[];
17
- /** Whether this agent was spawned (vs. independently deployed) */
18
- isSpawn: boolean;
19
- /** Generation depth — 0 = root, 1 = direct child, 2 = grandchild, etc. */
20
- generation: number;
21
- }
22
- export interface SpawnChild {
23
- address: string;
24
- soulCid: string | null;
25
- deploymentId: number | null;
26
- bundleName: string | null;
27
- createdAt: number;
28
- }
29
- export interface SpawnParent {
30
- address: string;
31
- soulCid: string | null;
32
- deploymentId: number | null;
33
- }
34
- export declare class LineageManager {
35
- private readonly connection;
36
- private cachedLineage;
37
- constructor(connection: ConnectionManager);
38
- /**
39
- * Get full lineage info for this agent (parent, children, generation).
40
- * Cached after first call — spawn tree is immutable on-chain.
41
- */
42
- getLineage(): Promise<LineageInfo>;
43
- /** Get this agent's parent info, or null if root deployment. */
44
- getParent(): Promise<SpawnParent | null>;
45
- /** Get this agent's direct children. */
46
- getChildren(): Promise<SpawnChild[]>;
47
- /** Get siblings (children of this agent's parent, excluding self). */
48
- getSiblings(): Promise<SpawnChild[]>;
49
- /** Whether this agent was spawned (not root deployed). */
50
- isSpawn(): Promise<boolean>;
51
- /**
52
- * Inherit filtered memories from parent agent.
53
- * Only works for spawned agents. No-op for root deployments.
54
- * Returns the number of memories inherited.
55
- */
56
- inheritFromParent(filter?: {
57
- types?: string[];
58
- tags?: string[];
59
- minImportance?: number;
60
- maxMemories?: number;
61
- }): Promise<{
62
- inherited: number;
63
- total: number;
64
- parentAddress: string | null;
65
- }>;
66
- /** Clear cached lineage (e.g., if new children were spawned). */
67
- clearCache(): void;
68
- }
69
- //# sourceMappingURL=lineage.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"lineage.d.ts","sourceRoot":"","sources":["../src/lineage.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAIzD,MAAM,WAAW,WAAW;IAC1B,2BAA2B;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,kEAAkE;IAClE,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,mCAAmC;IACnC,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,kEAAkE;IAClE,OAAO,EAAE,OAAO,CAAC;IACjB,0EAA0E;IAC1E,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,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forged agents.
3
- *
4
- * Lets agents discover their parent, children, and siblings
5
- * in the on-chain spawn tree (AgentFactory contract).
6
- *
7
- * @module lineage
8
- */
9
- // ─── Manager ──────────────────────────────────────────────────────────────────
10
- export class LineageManager {
11
- connection;
12
- cachedLineage = null;
13
- constructor(connection) {
14
- this.connection = connection;
15
- }
16
- /**
17
- * Get full lineage info for this agent (parent, children, generation).
18
- * Cached after first call — spawn tree is immutable on-chain.
19
- */
20
- async getLineage() {
21
- if (this.cachedLineage)
22
- return this.cachedLineage;
23
- const result = await this.connection.request("GET", "/v1/forge/lineage/self");
24
- this.cachedLineage = result;
25
- return result;
26
- }
27
- /** Get this agent's parent info, or null if root deployment. */
28
- async getParent() {
29
- const lineage = await this.getLineage();
30
- if (!lineage.parentAddress)
31
- return null;
32
- return this.connection.request("GET", `/v1/forge/parent/${lineage.parentAddress}`);
33
- }
34
- /** Get this agent's direct children. */
35
- async getChildren() {
36
- const lineage = await this.getLineage();
37
- if (lineage.childAddresses.length === 0)
38
- return [];
39
- const result = await this.connection.request("GET", `/v1/forge/tree/${lineage.address}`);
40
- return result.children ?? [];
41
- }
42
- /** Get siblings (children of this agent's parent, excluding self). */
43
- async getSiblings() {
44
- const lineage = await this.getLineage();
45
- if (!lineage.parentAddress)
46
- return [];
47
- const result = await this.connection.request("GET", `/v1/forge/tree/${lineage.parentAddress}`);
48
- return (result.children ?? []).filter(c => c.address !== lineage.address);
49
- }
50
- /** Whether this agent was spawned (not root deployed). */
51
- async isSpawn() {
52
- const lineage = await this.getLineage();
53
- return lineage.isSpawn;
54
- }
55
- /**
56
- * Inherit filtered memories from parent agent.
57
- * Only works for spawned agents. No-op for root deployments.
58
- * Returns the number of memories inherited.
59
- */
60
- async inheritFromParent(filter) {
61
- const lineage = await this.getLineage();
62
- if (!lineage.isSpawn) {
63
- return { inherited: 0, total: 0, parentAddress: null };
64
- }
65
- return this.connection.request("POST", "/v1/forge/inherit", filter ?? {});
66
- }
67
- /** Clear cached lineage (e.g., if new children were spawned). */
68
- clearCache() {
69
- this.cachedLineage = null;
70
- }
71
- }
72
- //# sourceMappingURL=lineage.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"lineage.js","sourceRoot":"","sources":["../src/lineage.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAiCH,iFAAiF;AAEjF,MAAM,OAAO,cAAc;IACR,UAAU,CAAoB;IACvC,aAAa,GAAuB,IAAI,CAAC;IAEjD,YAAY,UAA6B;QACvC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,UAAU;QACd,IAAI,IAAI,CAAC,aAAa;YAAE,OAAO,IAAI,CAAC,aAAa,CAAC;QAClD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAAc,KAAK,EAAE,wBAAwB,CAAC,CAAC;QAC3F,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC;QAC5B,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,gEAAgE;IAChE,KAAK,CAAC,SAAS;QACb,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC;QACxC,IAAI,CAAC,OAAO,CAAC,aAAa;YAAE,OAAO,IAAI,CAAC;QACxC,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAAc,KAAK,EAAE,oBAAoB,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC;IAClG,CAAC;IAED,wCAAwC;IACxC,KAAK,CAAC,WAAW;QACf,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC;QACxC,IAAI,OAAO,CAAC,cAAc,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,EAAE,CAAC;QACnD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAC1C,KAAK,EAAE,kBAAkB,OAAO,CAAC,OAAO,EAAE,CAC3C,CAAC;QACF,OAAO,MAAM,CAAC,QAAQ,IAAI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