@subcortex-ai/sdk 0.3.8 → 0.3.10
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/README.md +21 -0
- package/dist/index.cjs +31 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +31 -12
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -245,6 +245,8 @@ declare enum OrgRelationship {
|
|
|
245
245
|
HOLDS_ROLE = "holds_role",
|
|
246
246
|
/** Person is a candidate for a role */
|
|
247
247
|
CANDIDATE_FOR = "candidate_for",
|
|
248
|
+
/** User/manager is considering/evaluating a candidate (inverse of candidate_for) */
|
|
249
|
+
CONSIDERING = "considering",
|
|
248
250
|
/** Person collaborates with another person */
|
|
249
251
|
COLLABORATES_WITH = "collaborates_with",
|
|
250
252
|
/** Person mentors another person */
|
|
@@ -285,6 +287,8 @@ declare const RelationshipTypes: {
|
|
|
285
287
|
readonly HOLDS_ROLE: OrgRelationship.HOLDS_ROLE;
|
|
286
288
|
/** Person is a candidate for a role */
|
|
287
289
|
readonly CANDIDATE_FOR: OrgRelationship.CANDIDATE_FOR;
|
|
290
|
+
/** User/manager is considering/evaluating a candidate (inverse of candidate_for) */
|
|
291
|
+
readonly CONSIDERING: OrgRelationship.CONSIDERING;
|
|
288
292
|
/** Person collaborates with another person */
|
|
289
293
|
readonly COLLABORATES_WITH: OrgRelationship.COLLABORATES_WITH;
|
|
290
294
|
/** Person mentors another person */
|
|
@@ -457,6 +461,12 @@ interface IdentifyUserInput {
|
|
|
457
461
|
email?: string;
|
|
458
462
|
/** Agent ID — used to scope conflict detection to this agent's intake queue */
|
|
459
463
|
agentId?: string;
|
|
464
|
+
/**
|
|
465
|
+
* Whether to auto-dismiss reminders after surfacing them (default true).
|
|
466
|
+
* The agent leaves this on so a reminder surfaces once per session; set it to
|
|
467
|
+
* false for inspection/programmatic recall so reading does not consume reminders.
|
|
468
|
+
*/
|
|
469
|
+
dismissReminders?: boolean;
|
|
460
470
|
}
|
|
461
471
|
/** Result of user identification */
|
|
462
472
|
interface UserIdentification {
|
package/dist/index.d.ts
CHANGED
|
@@ -245,6 +245,8 @@ declare enum OrgRelationship {
|
|
|
245
245
|
HOLDS_ROLE = "holds_role",
|
|
246
246
|
/** Person is a candidate for a role */
|
|
247
247
|
CANDIDATE_FOR = "candidate_for",
|
|
248
|
+
/** User/manager is considering/evaluating a candidate (inverse of candidate_for) */
|
|
249
|
+
CONSIDERING = "considering",
|
|
248
250
|
/** Person collaborates with another person */
|
|
249
251
|
COLLABORATES_WITH = "collaborates_with",
|
|
250
252
|
/** Person mentors another person */
|
|
@@ -285,6 +287,8 @@ declare const RelationshipTypes: {
|
|
|
285
287
|
readonly HOLDS_ROLE: OrgRelationship.HOLDS_ROLE;
|
|
286
288
|
/** Person is a candidate for a role */
|
|
287
289
|
readonly CANDIDATE_FOR: OrgRelationship.CANDIDATE_FOR;
|
|
290
|
+
/** User/manager is considering/evaluating a candidate (inverse of candidate_for) */
|
|
291
|
+
readonly CONSIDERING: OrgRelationship.CONSIDERING;
|
|
288
292
|
/** Person collaborates with another person */
|
|
289
293
|
readonly COLLABORATES_WITH: OrgRelationship.COLLABORATES_WITH;
|
|
290
294
|
/** Person mentors another person */
|
|
@@ -457,6 +461,12 @@ interface IdentifyUserInput {
|
|
|
457
461
|
email?: string;
|
|
458
462
|
/** Agent ID — used to scope conflict detection to this agent's intake queue */
|
|
459
463
|
agentId?: string;
|
|
464
|
+
/**
|
|
465
|
+
* Whether to auto-dismiss reminders after surfacing them (default true).
|
|
466
|
+
* The agent leaves this on so a reminder surfaces once per session; set it to
|
|
467
|
+
* false for inspection/programmatic recall so reading does not consume reminders.
|
|
468
|
+
*/
|
|
469
|
+
dismissReminders?: boolean;
|
|
460
470
|
}
|
|
461
471
|
/** Result of user identification */
|
|
462
472
|
interface UserIdentification {
|
package/dist/index.js
CHANGED
|
@@ -406,6 +406,7 @@ var OrgRelationship = /* @__PURE__ */ ((OrgRelationship2) => {
|
|
|
406
406
|
OrgRelationship2["HAS_MEMBER"] = "has_member";
|
|
407
407
|
OrgRelationship2["HOLDS_ROLE"] = "holds_role";
|
|
408
408
|
OrgRelationship2["CANDIDATE_FOR"] = "candidate_for";
|
|
409
|
+
OrgRelationship2["CONSIDERING"] = "considering";
|
|
409
410
|
OrgRelationship2["COLLABORATES_WITH"] = "collaborates_with";
|
|
410
411
|
OrgRelationship2["MENTORS"] = "mentors";
|
|
411
412
|
OrgRelationship2["MENTORED_BY"] = "mentored_by";
|
|
@@ -475,7 +476,8 @@ var REVERSE_RELATIONSHIPS = {
|
|
|
475
476
|
["mentors" /* MENTORS */]: "mentored_by" /* MENTORED_BY */,
|
|
476
477
|
["mentored_by" /* MENTORED_BY */]: "mentors" /* MENTORS */,
|
|
477
478
|
["collaborates_with" /* COLLABORATES_WITH */]: "collaborates_with" /* COLLABORATES_WITH */,
|
|
478
|
-
["candidate_for" /* CANDIDATE_FOR */]: "
|
|
479
|
+
["candidate_for" /* CANDIDATE_FOR */]: "considering" /* CONSIDERING */,
|
|
480
|
+
["considering" /* CONSIDERING */]: "candidate_for" /* CANDIDATE_FOR */,
|
|
479
481
|
["stakeholder_in" /* STAKEHOLDER_IN */]: "stakeholder_in" /* STAKEHOLDER_IN */,
|
|
480
482
|
// Agent-facing predicate names → proper relationship types
|
|
481
483
|
// The model sends 'direct_report' as predicate, SDK maps to proper relationships
|
|
@@ -777,13 +779,15 @@ var UsersNamespace = class {
|
|
|
777
779
|
const nameAssertion = active.find((a) => a.predicate === "name" || a.predicate === "full_name");
|
|
778
780
|
const name = nameAssertion?.value || input.displayName || null;
|
|
779
781
|
const reminders = active.filter((a) => a.predicate === "reminder").map((a) => ({ id: a.id, predicate: a.predicate, value: a.value, confidence: a.confidence, createdAt: a.validFrom }));
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
782
|
+
if (input.dismissReminders !== false) {
|
|
783
|
+
for (const reminder of reminders) {
|
|
784
|
+
try {
|
|
785
|
+
await this.http.post(
|
|
786
|
+
`/api/v1/assertions/retract/${enc2(this.tenantId)}/${enc2(reminder.id)}`,
|
|
787
|
+
{}
|
|
788
|
+
);
|
|
789
|
+
} catch {
|
|
790
|
+
}
|
|
787
791
|
}
|
|
788
792
|
}
|
|
789
793
|
const contexts = active.filter((a) => a.predicate === "context" || a.predicate === "context:task").map((a) => ({ id: a.id, predicate: a.predicate, value: a.value, confidence: a.confidence, createdAt: a.validFrom }));
|
|
@@ -974,7 +978,7 @@ ${connectedPeople.map((p) => {
|
|
|
974
978
|
const FORWARD_MAP = {
|
|
975
979
|
"direct_report": "manages" /* MANAGES */,
|
|
976
980
|
"team_member": "has_member" /* HAS_MEMBER */,
|
|
977
|
-
"candidate": "
|
|
981
|
+
"candidate": "considering" /* CONSIDERING */,
|
|
978
982
|
"manager": "reports_to" /* REPORTS_TO */,
|
|
979
983
|
"stakeholder": "stakeholder_in" /* STAKEHOLDER_IN */,
|
|
980
984
|
"collaborator": "collaborates_with" /* COLLABORATES_WITH */,
|
|
@@ -1766,7 +1770,7 @@ var EntitiesNamespace = class {
|
|
|
1766
1770
|
`/api/v1/assertions/query/${enc4(tenantId)}/${enc4(subject2)}`
|
|
1767
1771
|
);
|
|
1768
1772
|
const relationships = await this.http.get(
|
|
1769
|
-
`/api/v1/relationships
|
|
1773
|
+
`/api/v1/relationships/${enc4(tenantId)}/${enc4(subject2)}`
|
|
1770
1774
|
);
|
|
1771
1775
|
const typeAssertion = assertions.find((a) => a.predicate === "type" && !a.isSuperseded);
|
|
1772
1776
|
const descAssertion = assertions.find((a) => a.predicate === "description" && !a.isSuperseded);
|
|
@@ -1979,16 +1983,25 @@ function toContextXml(user, options = {}) {
|
|
|
1979
1983
|
if (knowledge.length > 0) {
|
|
1980
1984
|
lines.push(` <knowledge count="${knowledge.length}">`);
|
|
1981
1985
|
for (const mem of knowledge) {
|
|
1986
|
+
if (mem.predicate.startsWith("signal:")) {
|
|
1987
|
+
const sigType = mem.predicate.slice(7);
|
|
1988
|
+
const val = mem.value;
|
|
1989
|
+
const content = typeof val === "object" && val?.content ? String(val.content) : formatValue(mem.value);
|
|
1990
|
+
const intensity = typeof val === "object" && val?.intensity ? Number(val.intensity) : mem.confidence;
|
|
1991
|
+
const about = typeof val === "object" && val?.aboutSubject ? ` about="${esc(String(val.aboutSubject))}"` : "";
|
|
1992
|
+
lines.push(` <signal type="${esc(sigType)}" intensity="${fmtConf(intensity)}"${about}>${esc(content)}</signal>`);
|
|
1993
|
+
continue;
|
|
1994
|
+
}
|
|
1982
1995
|
const memSignals = findSignalsForFact(mem, signalsByAbout);
|
|
1983
1996
|
if (memSignals.length > 0) {
|
|
1984
1997
|
lines.push(` <fact predicate="${esc(mem.predicate)}" confidence="${fmtConf(mem.confidence)}">`);
|
|
1985
|
-
lines.push(` ${esc(
|
|
1998
|
+
lines.push(` ${esc(formatValue(mem.value))}`);
|
|
1986
1999
|
for (const sig of memSignals) {
|
|
1987
2000
|
lines.push(` ${renderSignal(sig)}`);
|
|
1988
2001
|
}
|
|
1989
2002
|
lines.push(` </fact>`);
|
|
1990
2003
|
} else {
|
|
1991
|
-
lines.push(` <fact predicate="${esc(mem.predicate)}" confidence="${fmtConf(mem.confidence)}">${esc(
|
|
2004
|
+
lines.push(` <fact predicate="${esc(mem.predicate)}" confidence="${fmtConf(mem.confidence)}">${esc(formatValue(mem.value))}</fact>`);
|
|
1992
2005
|
}
|
|
1993
2006
|
}
|
|
1994
2007
|
lines.push(` </knowledge>`);
|
|
@@ -2030,6 +2043,12 @@ function findSignalsForFact(fact, signalsByAbout) {
|
|
|
2030
2043
|
}
|
|
2031
2044
|
return results;
|
|
2032
2045
|
}
|
|
2046
|
+
function formatValue(v) {
|
|
2047
|
+
if (v === null || v === void 0) return "";
|
|
2048
|
+
if (typeof v === "string") return v;
|
|
2049
|
+
if (typeof v === "object" && "content" in v) return String(v.content);
|
|
2050
|
+
return JSON.stringify(v);
|
|
2051
|
+
}
|
|
2033
2052
|
function fmtConf(n) {
|
|
2034
2053
|
return n.toFixed(2);
|
|
2035
2054
|
}
|