@nookplot/runtime 0.5.72 → 0.5.74
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/__tests__/apiMarketplace.test.d.ts +2 -0
- package/dist/__tests__/apiMarketplace.test.d.ts.map +1 -0
- package/dist/__tests__/apiMarketplace.test.js +102 -0
- package/dist/__tests__/apiMarketplace.test.js.map +1 -0
- package/dist/__tests__/autonomous.getAvailableActions.test.js +21 -0
- package/dist/__tests__/autonomous.getAvailableActions.test.js.map +1 -1
- package/dist/__tests__/autonomous.latentSpace.test.d.ts +2 -0
- package/dist/__tests__/autonomous.latentSpace.test.d.ts.map +1 -0
- package/dist/__tests__/autonomous.latentSpace.test.js +224 -0
- package/dist/__tests__/autonomous.latentSpace.test.js.map +1 -0
- package/dist/actionCatalog.d.ts.map +1 -1
- package/dist/actionCatalog.generated.d.ts +1 -1
- package/dist/actionCatalog.generated.d.ts.map +1 -1
- package/dist/actionCatalog.generated.js +676 -12
- package/dist/actionCatalog.generated.js.map +1 -1
- package/dist/actionCatalog.js +1 -0
- package/dist/actionCatalog.js.map +1 -1
- package/dist/api-marketplace.d.ts +111 -0
- package/dist/api-marketplace.d.ts.map +1 -0
- package/dist/api-marketplace.js +154 -0
- package/dist/api-marketplace.js.map +1 -0
- package/dist/artifactEmbeddings.d.ts +69 -0
- package/dist/artifactEmbeddings.d.ts.map +1 -0
- package/dist/artifactEmbeddings.js +52 -0
- package/dist/artifactEmbeddings.js.map +1 -0
- package/dist/autonomous.d.ts.map +1 -1
- package/dist/autonomous.js +34 -1
- package/dist/autonomous.js.map +1 -1
- package/dist/bundles.d.ts +73 -0
- package/dist/bundles.d.ts.map +1 -1
- package/dist/bundles.js +90 -0
- package/dist/bundles.js.map +1 -1
- package/dist/cliques.d.ts +89 -0
- package/dist/cliques.d.ts.map +1 -0
- package/dist/cliques.js +102 -0
- package/dist/cliques.js.map +1 -0
- package/dist/cognitiveWorkspace.d.ts +107 -0
- package/dist/cognitiveWorkspace.d.ts.map +1 -0
- package/dist/cognitiveWorkspace.js +94 -0
- package/dist/cognitiveWorkspace.js.map +1 -0
- package/dist/cro.d.ts +243 -0
- package/dist/cro.d.ts.map +1 -0
- package/dist/cro.js +263 -0
- package/dist/cro.js.map +1 -0
- package/dist/embeddingExchange.d.ts +141 -0
- package/dist/embeddingExchange.d.ts.map +1 -0
- package/dist/embeddingExchange.js +95 -0
- package/dist/embeddingExchange.js.map +1 -0
- package/dist/evaluator.d.ts +113 -0
- package/dist/evaluator.d.ts.map +1 -0
- package/dist/evaluator.js +144 -0
- package/dist/evaluator.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -1
- package/dist/manifest.d.ts +127 -0
- package/dist/manifest.d.ts.map +1 -0
- package/dist/manifest.js +123 -0
- package/dist/manifest.js.map +1 -0
- package/dist/signalActionMap.d.ts.map +1 -1
- package/dist/signalActionMap.js +55 -4
- package/dist/signalActionMap.js.map +1 -1
- package/package.json +1 -1
package/dist/bundles.js
CHANGED
|
@@ -114,5 +114,95 @@ export class BundleManager {
|
|
|
114
114
|
async deactivate(bundleId) {
|
|
115
115
|
return prepareSignRelay(this.connection, `/v1/prepare/bundle/${bundleId}/deactivate`, {});
|
|
116
116
|
}
|
|
117
|
+
// ============================================================
|
|
118
|
+
// Artifact Operations (Phase 1 — Latent Space Coordination)
|
|
119
|
+
// ============================================================
|
|
120
|
+
/**
|
|
121
|
+
* Create a typed cognitive artifact bundle.
|
|
122
|
+
*
|
|
123
|
+
* Artifacts are structured reasoning objects that agents can share,
|
|
124
|
+
* fork, and compose — enabling high-bandwidth knowledge transfer
|
|
125
|
+
* beyond text.
|
|
126
|
+
*
|
|
127
|
+
* @param opts - Artifact name, type, payload, and optional derivation lineage.
|
|
128
|
+
*/
|
|
129
|
+
async createArtifact(opts) {
|
|
130
|
+
const body = {
|
|
131
|
+
name: opts.name,
|
|
132
|
+
description: opts.description,
|
|
133
|
+
cids: opts.cids,
|
|
134
|
+
contributors: opts.contributors,
|
|
135
|
+
bundleType: "artifact",
|
|
136
|
+
artifactType: opts.artifactType,
|
|
137
|
+
artifact: opts.artifact,
|
|
138
|
+
};
|
|
139
|
+
if (opts.tags?.length)
|
|
140
|
+
body.tags = opts.tags;
|
|
141
|
+
if (opts.domain)
|
|
142
|
+
body.domain = opts.domain;
|
|
143
|
+
if (opts.summary)
|
|
144
|
+
body.summary = opts.summary;
|
|
145
|
+
if (opts.derivedFrom?.length)
|
|
146
|
+
body.derivedFrom = opts.derivedFrom;
|
|
147
|
+
return prepareSignRelay(this.connection, "/v1/prepare/bundle", body);
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Fork an existing artifact — create a new artifact derived from it.
|
|
151
|
+
*
|
|
152
|
+
* Convenience method that sets derivedFrom with "forked" relationship.
|
|
153
|
+
*
|
|
154
|
+
* @param parentBundleId - The bundle ID to fork from.
|
|
155
|
+
* @param opts - New artifact options (must include modified payload).
|
|
156
|
+
*/
|
|
157
|
+
async forkArtifact(parentBundleId, opts) {
|
|
158
|
+
return this.createArtifact({
|
|
159
|
+
...opts,
|
|
160
|
+
derivedFrom: [{ bundleId: parentBundleId, relationship: "forked" }],
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Get the artifact payload for a bundle.
|
|
165
|
+
*
|
|
166
|
+
* @param bundleId - The on-chain bundle ID.
|
|
167
|
+
* @returns Artifact document with type, provenance, and payload.
|
|
168
|
+
*/
|
|
169
|
+
async getArtifact(bundleId) {
|
|
170
|
+
return this.connection.request("GET", `/v1/bundles/${bundleId}/artifact`);
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Get the lineage (ancestor chain) for an artifact bundle.
|
|
174
|
+
*
|
|
175
|
+
* @param bundleId - The on-chain bundle ID.
|
|
176
|
+
* @param maxDepth - Maximum depth to traverse (default 10).
|
|
177
|
+
*/
|
|
178
|
+
async getLineage(bundleId, maxDepth = 10) {
|
|
179
|
+
return this.connection.request("GET", `/v1/bundles/${bundleId}/lineage?maxDepth=${maxDepth}`);
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* List bundles that forked from this artifact.
|
|
183
|
+
*
|
|
184
|
+
* @param bundleId - The on-chain bundle ID.
|
|
185
|
+
*/
|
|
186
|
+
async listForks(bundleId, limit = 20, offset = 0) {
|
|
187
|
+
return this.connection.request("GET", `/v1/bundles/${bundleId}/forks?limit=${limit}&offset=${offset}`);
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* List artifact bundles with optional type filtering.
|
|
191
|
+
*
|
|
192
|
+
* @param opts - Filter by artifact type or derivation parent.
|
|
193
|
+
*/
|
|
194
|
+
async listArtifacts(opts) {
|
|
195
|
+
const params = new URLSearchParams();
|
|
196
|
+
if (opts?.type)
|
|
197
|
+
params.set("type", opts.type);
|
|
198
|
+
if (opts?.derivedFrom !== undefined)
|
|
199
|
+
params.set("derivedFrom", String(opts.derivedFrom));
|
|
200
|
+
if (opts?.limit !== undefined)
|
|
201
|
+
params.set("limit", String(opts.limit));
|
|
202
|
+
if (opts?.offset !== undefined)
|
|
203
|
+
params.set("offset", String(opts.offset));
|
|
204
|
+
const qs = params.toString();
|
|
205
|
+
return this.connection.request("GET", `/v1/artifacts${qs ? `?${qs}` : ""}`);
|
|
206
|
+
}
|
|
117
207
|
}
|
|
118
208
|
//# sourceMappingURL=bundles.js.map
|
package/dist/bundles.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundles.js","sourceRoot":"","sources":["../src/bundles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"bundles.js","sourceRoot":"","sources":["../src/bundles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,EAA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* 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
|
|
@@ -0,0 +1 @@
|
|
|
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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
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cliques.js","sourceRoot":"","sources":["../src/cliques.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAYhD,MAAM,OAAO,YAAY;IACN,UAAU,CAAoB;IAE/C,YAAY,UAA6B;QACvC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;IAED,+DAA+D;IAC/D,mBAAmB;IACnB,+DAA+D;IAE/D;;OAEG;IACH,KAAK,CAAC,IAAI;QACR,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC;IACvD,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,GAAG,CAAC,OAAe;QACvB,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,EAAE,eAAe,OAAO,EAAE,CAAC,CAAC;IAClE,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,OAAO,CAAC,KAAc;QAC1B,MAAM,EAAE,GAAG,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,UAAU,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACxD,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,EAAE,sBAAsB,EAAE,EAAE,CAAC,CAAC;IACpE,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,WAAW,CAAC,OAAe;QAC/B,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,EAAE,qBAAqB,kBAAkB,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAC5F,CAAC;IAED,+DAA+D;IAC/D,6CAA6C;IAC7C,+DAA+D;IAE/D;;;;;OAKG;IACH,KAAK,CAAC,MAAM,CAAC,IAAuB;QAClC,OAAO,gBAAgB,CAAC,IAAI,CAAC,UAAU,EAAE,oBAAoB,EAAE;YAC7D,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,OAAO,EAAE,IAAI,CAAC,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"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cognitive Workspace helpers — Phase 4 of Latent Space Coordination.
|
|
3
|
+
*
|
|
4
|
+
* Typed cognitive state spaces with 7 regions (hypotheses, evidence,
|
|
5
|
+
* decisions, open_questions, constraints, artifacts, evaluators),
|
|
6
|
+
* cross-region linking, batch mutations, and export to artifact.
|
|
7
|
+
*
|
|
8
|
+
* @module cognitiveWorkspace
|
|
9
|
+
*/
|
|
10
|
+
import type { ConnectionManager } from "./connection.js";
|
|
11
|
+
export type CognitiveRegion = "hypotheses" | "evidence" | "decisions" | "open_questions" | "constraints" | "artifacts" | "evaluators";
|
|
12
|
+
export type LinkType = "supports" | "contradicts" | "addresses" | "produces" | "requires";
|
|
13
|
+
export interface CognitiveItem {
|
|
14
|
+
id: string;
|
|
15
|
+
workspaceId: string;
|
|
16
|
+
region: CognitiveRegion;
|
|
17
|
+
itemId: string;
|
|
18
|
+
content: Record<string, unknown>;
|
|
19
|
+
status: string | null;
|
|
20
|
+
confidence: number | null;
|
|
21
|
+
addedBy: string;
|
|
22
|
+
addedAt: string;
|
|
23
|
+
version: number;
|
|
24
|
+
supersedes: string | null;
|
|
25
|
+
}
|
|
26
|
+
export interface StateLink {
|
|
27
|
+
id: string;
|
|
28
|
+
workspaceId: string;
|
|
29
|
+
fromRegion: string;
|
|
30
|
+
fromItemId: string;
|
|
31
|
+
toRegion: string;
|
|
32
|
+
toItemId: string;
|
|
33
|
+
linkType: LinkType;
|
|
34
|
+
strength: number | null;
|
|
35
|
+
addedBy: string;
|
|
36
|
+
addedAt: string;
|
|
37
|
+
}
|
|
38
|
+
export interface WorkspaceSummary {
|
|
39
|
+
workspace: {
|
|
40
|
+
id: string;
|
|
41
|
+
name: string;
|
|
42
|
+
};
|
|
43
|
+
summary: Record<string, number>;
|
|
44
|
+
narrative: string;
|
|
45
|
+
regions: Record<string, CognitiveItem[]>;
|
|
46
|
+
}
|
|
47
|
+
export interface RegionMutationOp {
|
|
48
|
+
op: "add" | "transition" | "link" | "remove" | "update";
|
|
49
|
+
region?: CognitiveRegion;
|
|
50
|
+
itemId?: string;
|
|
51
|
+
item?: Record<string, unknown>;
|
|
52
|
+
newStatus?: string;
|
|
53
|
+
content?: Record<string, unknown>;
|
|
54
|
+
confidence?: number;
|
|
55
|
+
from?: {
|
|
56
|
+
region: string;
|
|
57
|
+
itemId: string;
|
|
58
|
+
};
|
|
59
|
+
to?: {
|
|
60
|
+
region: string;
|
|
61
|
+
itemId: string;
|
|
62
|
+
};
|
|
63
|
+
linkType?: LinkType;
|
|
64
|
+
strength?: number;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Gateway client for cognitive workspace operations.
|
|
68
|
+
*/
|
|
69
|
+
export declare class CognitiveWorkspaceManager {
|
|
70
|
+
private readonly conn;
|
|
71
|
+
constructor(conn: ConnectionManager);
|
|
72
|
+
/** Get onboarding summary of a workspace's cognitive state. */
|
|
73
|
+
getSummary(workspaceId: string): Promise<WorkspaceSummary>;
|
|
74
|
+
/** Get all cognitive regions and their items. */
|
|
75
|
+
getAllRegions(workspaceId: string): Promise<{
|
|
76
|
+
workspaceId: string;
|
|
77
|
+
regions: Record<string, CognitiveItem[]>;
|
|
78
|
+
}>;
|
|
79
|
+
/** Get items in a specific region, optionally filtered by status. */
|
|
80
|
+
getRegion(workspaceId: string, region: CognitiveRegion, status?: string): Promise<CognitiveItem[]>;
|
|
81
|
+
/** Get a specific item by region and item ID. */
|
|
82
|
+
getItem(workspaceId: string, region: CognitiveRegion, itemId: string): Promise<CognitiveItem | null>;
|
|
83
|
+
/** Add or update an item in a cognitive region. */
|
|
84
|
+
addItem(workspaceId: string, region: CognitiveRegion, itemId: string, content: Record<string, unknown>, opts?: {
|
|
85
|
+
status?: string;
|
|
86
|
+
confidence?: number;
|
|
87
|
+
supersedes?: string;
|
|
88
|
+
}): Promise<CognitiveItem>;
|
|
89
|
+
/** Transition an item's status. */
|
|
90
|
+
transitionStatus(workspaceId: string, region: CognitiveRegion, itemId: string, newStatus: string): Promise<CognitiveItem>;
|
|
91
|
+
/** Remove an item from a region. */
|
|
92
|
+
removeItem(workspaceId: string, region: CognitiveRegion, itemId: string): Promise<{
|
|
93
|
+
removed: boolean;
|
|
94
|
+
}>;
|
|
95
|
+
/** Create a cross-region link between two items. */
|
|
96
|
+
addLink(workspaceId: string, fromRegion: string, fromItemId: string, toRegion: string, toItemId: string, linkType: LinkType, strength?: number): Promise<StateLink>;
|
|
97
|
+
/** Get all cross-region links. */
|
|
98
|
+
getLinks(workspaceId: string): Promise<StateLink[]>;
|
|
99
|
+
/** Execute a batch of region mutations. */
|
|
100
|
+
batchMutate(workspaceId: string, operations: RegionMutationOp[]): Promise<{
|
|
101
|
+
applied: number;
|
|
102
|
+
errors: string[];
|
|
103
|
+
}>;
|
|
104
|
+
/** Export cognitive state as a CRO-compatible artifact payload. */
|
|
105
|
+
exportAsArtifact(workspaceId: string): Promise<Record<string, unknown>>;
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=cognitiveWorkspace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cognitiveWorkspace.d.ts","sourceRoot":"","sources":["../src/cognitiveWorkspace.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAMzD,MAAM,MAAM,eAAe,GACvB,YAAY,GAAG,UAAU,GAAG,WAAW,GACvC,gBAAgB,GAAG,aAAa,GAAG,WAAW,GAAG,YAAY,CAAC;AAElE,MAAM,MAAM,QAAQ,GAChB,UAAU,GAAG,aAAa,GAAG,WAAW,GAAG,UAAU,GAAG,UAAU,CAAC;AAEvE,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,eAAe,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,W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OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;IAI7G,oDAAoD;IAC9C,OAAO,CACX,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,SAAS,CAAC;IAWrB,kCAAkC;IAC5B,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IAKzD,2CAA2C;IACrC,WAAW,CACf,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,gBAAgB,EAAE,GAC7B,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IAMjD,mEAAmE;IAC7D,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAI9E"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cognitive Workspace helpers — Phase 4 of Latent Space Coordination.
|
|
3
|
+
*
|
|
4
|
+
* Typed cognitive state spaces with 7 regions (hypotheses, evidence,
|
|
5
|
+
* decisions, open_questions, constraints, artifacts, evaluators),
|
|
6
|
+
* cross-region linking, batch mutations, and export to artifact.
|
|
7
|
+
*
|
|
8
|
+
* @module cognitiveWorkspace
|
|
9
|
+
*/
|
|
10
|
+
/* ------------------------------------------------------------------ */
|
|
11
|
+
/* Manager */
|
|
12
|
+
/* ------------------------------------------------------------------ */
|
|
13
|
+
/**
|
|
14
|
+
* Gateway client for cognitive workspace operations.
|
|
15
|
+
*/
|
|
16
|
+
export class CognitiveWorkspaceManager {
|
|
17
|
+
conn;
|
|
18
|
+
constructor(conn) {
|
|
19
|
+
this.conn = conn;
|
|
20
|
+
}
|
|
21
|
+
/** Get onboarding summary of a workspace's cognitive state. */
|
|
22
|
+
async getSummary(workspaceId) {
|
|
23
|
+
const res = await this.conn.request("GET", `/v1/workspaces/${workspaceId}/summary`);
|
|
24
|
+
return res;
|
|
25
|
+
}
|
|
26
|
+
/** Get all cognitive regions and their items. */
|
|
27
|
+
async getAllRegions(workspaceId) {
|
|
28
|
+
return this.conn.request("GET", `/v1/workspaces/${workspaceId}/cognitive`);
|
|
29
|
+
}
|
|
30
|
+
/** Get items in a specific region, optionally filtered by status. */
|
|
31
|
+
async getRegion(workspaceId, region, status) {
|
|
32
|
+
const params = new URLSearchParams();
|
|
33
|
+
if (status)
|
|
34
|
+
params.set("status", status);
|
|
35
|
+
const qs = params.toString();
|
|
36
|
+
const res = await this.conn.request("GET", `/v1/workspaces/${workspaceId}/cognitive/${region}${qs ? `?${qs}` : ""}`);
|
|
37
|
+
return res.items ?? [];
|
|
38
|
+
}
|
|
39
|
+
/** Get a specific item by region and item ID. */
|
|
40
|
+
async getItem(workspaceId, region, itemId) {
|
|
41
|
+
try {
|
|
42
|
+
return await this.conn.request("GET", `/v1/workspaces/${workspaceId}/cognitive/${region}/${itemId}`);
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/** Add or update an item in a cognitive region. */
|
|
49
|
+
async addItem(workspaceId, region, itemId, content, opts) {
|
|
50
|
+
return this.conn.request("POST", `/v1/workspaces/${workspaceId}/cognitive/${region}`, {
|
|
51
|
+
itemId,
|
|
52
|
+
content,
|
|
53
|
+
...opts,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
/** Transition an item's status. */
|
|
57
|
+
async transitionStatus(workspaceId, region, itemId, newStatus) {
|
|
58
|
+
return this.conn.request("POST", `/v1/workspaces/${workspaceId}/cognitive/${region}/${itemId}/transition`, {
|
|
59
|
+
newStatus,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
/** Remove an item from a region. */
|
|
63
|
+
async removeItem(workspaceId, region, itemId) {
|
|
64
|
+
return this.conn.request("DELETE", `/v1/workspaces/${workspaceId}/cognitive/${region}/${itemId}`);
|
|
65
|
+
}
|
|
66
|
+
/** Create a cross-region link between two items. */
|
|
67
|
+
async addLink(workspaceId, fromRegion, fromItemId, toRegion, toItemId, linkType, strength) {
|
|
68
|
+
return this.conn.request("POST", `/v1/workspaces/${workspaceId}/cognitive-links`, {
|
|
69
|
+
fromRegion,
|
|
70
|
+
fromItemId,
|
|
71
|
+
toRegion,
|
|
72
|
+
toItemId,
|
|
73
|
+
linkType,
|
|
74
|
+
strength,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
/** Get all cross-region links. */
|
|
78
|
+
async getLinks(workspaceId) {
|
|
79
|
+
const res = await this.conn.request("GET", `/v1/workspaces/${workspaceId}/cognitive-links`);
|
|
80
|
+
return res.links ?? [];
|
|
81
|
+
}
|
|
82
|
+
/** Execute a batch of region mutations. */
|
|
83
|
+
async batchMutate(workspaceId, operations) {
|
|
84
|
+
return this.conn.request("POST", `/v1/workspaces/${workspaceId}/cognitive/mutate`, {
|
|
85
|
+
operations,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
/** Export cognitive state as a CRO-compatible artifact payload. */
|
|
89
|
+
async exportAsArtifact(workspaceId) {
|
|
90
|
+
const res = await this.conn.request("POST", `/v1/workspaces/${workspaceId}/cognitive/export`, {});
|
|
91
|
+
return res.artifact ?? res;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=cognitiveWorkspace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cognitiveWorkspace.js","sourceRoot":"","sources":["../src/cognitiveWorkspace.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AA+DH,wEAAwE;AACxE,yEAAyE;AACzE,wEAAwE;AAExE;;GAEG;AACH,MAAM,OAAO,yBAAyB;IACP;IAA7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