@triplef/agent 2.0.0 → 2.1.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/LICENSE +106 -0
- package/README.md +4 -4
- package/dist/prompts/index.mjs +4 -3
- package/dist/schemas/index.mjs +2 -2
- package/package.json +23 -24
package/LICENSE
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# PolyForm Strict License 1.0.0
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Eugen Hildt
|
|
4
|
+
|
|
5
|
+
https://polyformproject.org/licenses/strict/1.0.0
|
|
6
|
+
|
|
7
|
+
## Acceptance
|
|
8
|
+
|
|
9
|
+
In order to get any license under these terms, you must agree
|
|
10
|
+
to them as both strict obligations and conditions to all
|
|
11
|
+
your licenses.
|
|
12
|
+
|
|
13
|
+
## Copyright License
|
|
14
|
+
|
|
15
|
+
The licensor grants you a copyright license for the software
|
|
16
|
+
to do everything you might do with the software that would
|
|
17
|
+
otherwise infringe the licensor's copyright in it for any
|
|
18
|
+
permitted purpose, other than distributing the software or
|
|
19
|
+
making changes or new works based on the software.
|
|
20
|
+
|
|
21
|
+
## Patent License
|
|
22
|
+
|
|
23
|
+
The licensor grants you a patent license for the software that
|
|
24
|
+
covers patent claims the licensor can license, or becomes able
|
|
25
|
+
to license, that you would infringe by using the software.
|
|
26
|
+
|
|
27
|
+
## Noncommercial Purposes
|
|
28
|
+
|
|
29
|
+
Any noncommercial purpose is a permitted purpose.
|
|
30
|
+
|
|
31
|
+
## Personal Uses
|
|
32
|
+
|
|
33
|
+
Personal use for research, experiment, and testing for
|
|
34
|
+
the benefit of public knowledge, personal study, private
|
|
35
|
+
entertainment, hobby projects, amateur pursuits, or religious
|
|
36
|
+
observance, without any anticipated commercial application,
|
|
37
|
+
is use for a permitted purpose.
|
|
38
|
+
|
|
39
|
+
## Noncommercial Organizations
|
|
40
|
+
|
|
41
|
+
Use by any charitable organization, educational institution,
|
|
42
|
+
public research organization, public safety or health
|
|
43
|
+
organization, environmental protection organization,
|
|
44
|
+
or government institution is use for a permitted purpose
|
|
45
|
+
regardless of the source of funding or obligations resulting
|
|
46
|
+
from the funding.
|
|
47
|
+
|
|
48
|
+
## Fair Use
|
|
49
|
+
|
|
50
|
+
You may have "fair use" rights for the software under the
|
|
51
|
+
law. These terms do not limit them.
|
|
52
|
+
|
|
53
|
+
## No Other Rights
|
|
54
|
+
|
|
55
|
+
These terms do not allow you to sublicense or transfer any of
|
|
56
|
+
your licenses to anyone else, or prevent the licensor from
|
|
57
|
+
granting licenses to anyone else. These terms do not imply
|
|
58
|
+
any other licenses.
|
|
59
|
+
|
|
60
|
+
## Patent Defense
|
|
61
|
+
|
|
62
|
+
If you make any written claim that the software infringes or
|
|
63
|
+
contributes to infringement of any patent, your patent license
|
|
64
|
+
for the software granted under these terms ends immediately. If
|
|
65
|
+
your company makes such a claim, your patent license ends
|
|
66
|
+
immediately for work on behalf of your company.
|
|
67
|
+
|
|
68
|
+
## Violations
|
|
69
|
+
|
|
70
|
+
The first time you are notified in writing that you have
|
|
71
|
+
violated any of these terms, or done anything with the software
|
|
72
|
+
not covered by your licenses, your licenses can nonetheless
|
|
73
|
+
continue if you come into full compliance with these terms,
|
|
74
|
+
and take practical steps to correct past violations, within
|
|
75
|
+
32 days of receiving notice. Otherwise, all your licenses
|
|
76
|
+
end immediately.
|
|
77
|
+
|
|
78
|
+
## No Liability
|
|
79
|
+
|
|
80
|
+
***As far as the law allows, the software comes as is, without
|
|
81
|
+
any warranty or condition, and the licensor will not be liable
|
|
82
|
+
to you for any damages arising out of these terms or the use
|
|
83
|
+
or nature of the software, under any kind of legal claim.***
|
|
84
|
+
|
|
85
|
+
## Definitions
|
|
86
|
+
|
|
87
|
+
The **licensor** is the individual or entity offering these
|
|
88
|
+
terms, and the **software** is the software the licensor makes
|
|
89
|
+
available under these terms.
|
|
90
|
+
|
|
91
|
+
**You** refers to the individual or entity agreeing to these
|
|
92
|
+
terms.
|
|
93
|
+
|
|
94
|
+
**Your company** is any legal entity, sole proprietorship,
|
|
95
|
+
or other kind of organization that you work for, plus all
|
|
96
|
+
organizations that have control over, are under the control of,
|
|
97
|
+
or are under common control with that organization. **Control**
|
|
98
|
+
means ownership of substantially all the assets of an entity,
|
|
99
|
+
or the power to direct its management and policies by vote,
|
|
100
|
+
contract, or otherwise. Control can be direct or indirect.
|
|
101
|
+
|
|
102
|
+
**Your licenses** are all the licenses granted to you for the
|
|
103
|
+
software under these terms.
|
|
104
|
+
|
|
105
|
+
**Use** means anything you do with the software requiring one
|
|
106
|
+
of your licenses.
|
package/README.md
CHANGED
|
@@ -33,7 +33,7 @@ The tripleF (3F) agent domain — structured-output schemas, prompt builders, an
|
|
|
33
33
|
# Dependencies
|
|
34
34
|
|
|
35
35
|
[](https://github.com/mozilla/readability)
|
|
36
|
-
[](https://github.com/ehildt/tripleF)
|
|
37
37
|
[](https://github.com/WebReflection/linkedom)
|
|
38
38
|
[](https://github.com/mixmark-io/turndown)
|
|
39
39
|
|
|
@@ -65,12 +65,12 @@ The tripleF (3F) agent domain — structured-output schemas, prompt builders, an
|
|
|
65
65
|

|
|
66
66
|

|
|
67
67
|

|
|
68
|
-

|
|
69
69
|

|
|
70
70
|

|
|
71
71
|

|
|
72
72
|

|
|
73
|
-

|
|
74
74
|

|
|
75
75
|
|
|
76
76
|
</div>
|
|
@@ -83,7 +83,7 @@ The tripleF (3F) agent domain — structured-output schemas, prompt builders, an
|
|
|
83
83
|
|
|
84
84
|
# PeerDependencies
|
|
85
85
|
|
|
86
|
-
[](https://github.com/vercel/ai)
|
|
87
87
|
[](https://github.com/colinhacks/zod)
|
|
88
88
|
|
|
89
89
|
</div>
|
package/dist/prompts/index.mjs
CHANGED
|
@@ -321,10 +321,10 @@ function isAbsoluteHttpUrl(value) {
|
|
|
321
321
|
}
|
|
322
322
|
|
|
323
323
|
// src/schemas/helpers/url-trust/safe-media-url.helper.ts
|
|
324
|
-
var
|
|
324
|
+
var OBJECT_STORAGE_URL_PATTERN = /^\/api\/v1\/object-storage\/[A-Za-z0-9_-]+\/[A-Za-z0-9_-]+\/[A-Za-z0-9]+$/;
|
|
325
325
|
function safeMediaUrl(message = "must be a safe media URL") {
|
|
326
326
|
const text = typeof message === "string" ? message : message.message;
|
|
327
|
-
return z.string().refine((value) =>
|
|
327
|
+
return z.string().refine((value) => OBJECT_STORAGE_URL_PATTERN.test(value) || isAbsoluteHttpUrl(value), { message: text });
|
|
328
328
|
}
|
|
329
329
|
|
|
330
330
|
// src/schemas/helpers/url-trust/safe-media-url-or-empty.helper.ts
|
|
@@ -2797,7 +2797,7 @@ function buildCognitionProfileSection(profileJson) {
|
|
|
2797
2797
|
const trimmed = profileJson.trim();
|
|
2798
2798
|
if (!trimmed) return void 0;
|
|
2799
2799
|
const capped = trimmed.length > COGNITION_PROFILE_CHAR_LIMIT ? `${trimmed.slice(0, COGNITION_PROFILE_CHAR_LIMIT)}\u2026` : trimmed;
|
|
2800
|
-
return `COGNITION PROFILE \u2014 YOUR accumulated understanding of this user: your own derived conclusions (traits, interests, standing context), not their verbatim statements. Use it to resolve what the user is referring to and to shape tool choices; never treat it as the current request itself.
|
|
2800
|
+
return `COGNITION PROFILE \u2014 YOUR accumulated understanding of this user: your own derived conclusions (traits, interests, standing context), not their verbatim statements. Use it to resolve what the user is referring to and to shape tool choices; never treat it as the current request itself. An optional retrievalHeat object maps profile paths to normalized 0..1 retrieval-frequency weights: hotter entries may be stronger personalization candidates, but heat is usage history, never proof, confidence, or user intent; missing/cold entries are neutral, not false.
|
|
2801
2801
|
${capped}`;
|
|
2802
2802
|
}
|
|
2803
2803
|
|
|
@@ -3436,6 +3436,7 @@ You receive:
|
|
|
3436
3436
|
|
|
3437
3437
|
Rules:
|
|
3438
3438
|
- Evidence only: record ONLY what this payload supports \u2014 USER REQUEST, ASSISTANT RESPONSE, CURRENT PROFILE, DERIVED INSIGHTS. Never guess or invent attributes (name, language, timezone, expertise, likes, interests, goals \u2026) the turn did not state or clearly imply; a value you do not know is an OMISSION, never a null and never a guess.
|
|
3439
|
+
- Likes/dislikes need EXPLICIT user evidence: promote a value into profile "likes" or "dislikes" only when the USER explicitly states a standing preference ("I like\u2026", "I dislike\u2026", "I prefer\u2026", or a direct correction of an earlier preference). A search, purchase, play/watch/listen request, one-off task, or assistant recommendation alone shows current activity, not a standing like/dislike \u2014 omit those profile fields unless the user states the preference. When the turn only implies an interest, keep it out of likes/dislikes; a hedged insight is acceptable only when the payload supports a durable, useful connection. Never derive a preference from the ASSISTANT RESPONSE alone.
|
|
3439
3440
|
- Exclusive home of the subjective: THIS cognition tier is the ONLY store for user profile data \u2014 stated preferences and interests ("the user likes\u2026", "the user is interested in\u2026") as well as derived durable characteristics, goals, expertise, communication style. When the user STATES a preference or interest, record it here (a short profile topic, plus an insight when there is depth) \u2014 never skip it as "a fact for the memory records": the objective fact partition is barred from carrying preferences, so a preference you do not record is lost. Never one-off moods, task content, or objective facts (contacts, project details, events) \u2014 objective records belong to the memory partition, never to this profile.
|
|
3440
3441
|
- Persona is about YOU: when the user names you, assigns you a role, or describes how you should behave or speak, record it under "persona" (name, role, personality, greeting, voice). Evidence only \u2014 never invent a name or role the user did not give, and never copy the user's own attributes into persona. Persona values are short strings too (name "Sam", role "coding assistant"), never sentences.
|
|
3441
3442
|
- Corrections are lessons: when the user corrects you ("don't do X", "always do Y", "that's wrong \u2014 do Z instead"), record it under "corrections" as a short imperative directive keyed by a lowercase dash-joined slug ("lint-before-commit": "always run lint before committing"). The key is a stable handle for later update/remove \u2014 the value is what matters. Evidence only \u2014 never invent a correction the user did not make. To revise a correction, re-emit its key with the new value; to remove one, set its value to null.
|
package/dist/schemas/index.mjs
CHANGED
|
@@ -339,10 +339,10 @@ function isTrustedUrl(url, options = {}) {
|
|
|
339
339
|
}
|
|
340
340
|
return true;
|
|
341
341
|
}
|
|
342
|
-
var
|
|
342
|
+
var OBJECT_STORAGE_URL_PATTERN = /^\/api\/v1\/object-storage\/[A-Za-z0-9_-]+\/[A-Za-z0-9_-]+\/[A-Za-z0-9]+$/;
|
|
343
343
|
function safeMediaUrl(message = "must be a safe media URL") {
|
|
344
344
|
const text = typeof message === "string" ? message : message.message;
|
|
345
|
-
return z.string().refine((value) =>
|
|
345
|
+
return z.string().refine((value) => OBJECT_STORAGE_URL_PATTERN.test(value) || isAbsoluteHttpUrl(value), { message: text });
|
|
346
346
|
}
|
|
347
347
|
function safeMediaUrlOrEmpty(message = "must be a safe media URL") {
|
|
348
348
|
return safeMediaUrl(message).optional().or(z.literal(""));
|
package/package.json
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@triplef/agent",
|
|
3
3
|
"description": "tripleF (3F) agent domain — structured-output schemas, prompt builders, and model tools shared across the apps.",
|
|
4
|
-
"version": "2.
|
|
5
|
-
"
|
|
6
|
-
"license": "MIT",
|
|
4
|
+
"version": "2.1.0",
|
|
5
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
7
6
|
"type": "module",
|
|
8
7
|
"exports": {
|
|
9
8
|
"./schemas": {
|
|
@@ -37,30 +36,14 @@
|
|
|
37
36
|
"bugs": {
|
|
38
37
|
"email": "eugen.hildt@gmail.com"
|
|
39
38
|
},
|
|
40
|
-
"scripts": {
|
|
41
|
-
"build": "pnpm tsup",
|
|
42
|
-
"prebuild": "rimraf dist",
|
|
43
|
-
"depcheck": "npx depcheck .",
|
|
44
|
-
"depcruise": "npx dependency-cruiser -c .depcruise.mjs --ts-config tsconfig.json src",
|
|
45
|
-
"format": "prettier --write .",
|
|
46
|
-
"lint": "eslint ./src",
|
|
47
|
-
"lint-staged": "npx lint-staged --allow-empty",
|
|
48
|
-
"ncu:update": "npx npm-check-updates -u --format group --dep prod,dev,optional,packageManager,peer",
|
|
49
|
-
"ncu:interactive": "npx npm-check-updates -u --interactive --format group",
|
|
50
|
-
"ncu:validate": "npx npm-check-updates -e 2 --packageFile=./package.json",
|
|
51
|
-
"test": "vitest run",
|
|
52
|
-
"test:watch": "vitest",
|
|
53
|
-
"test:cov": "vitest run --coverage",
|
|
54
|
-
"lint:unused": "npx ts-unused-exports ./tsconfig.exclude.json --maxIssues=6"
|
|
55
|
-
},
|
|
56
39
|
"dependencies": {
|
|
57
40
|
"@mozilla/readability": "^0.6.0",
|
|
58
|
-
"@triplef/helpers": "^1.6.
|
|
41
|
+
"@triplef/helpers": "^1.6.4",
|
|
59
42
|
"linkedom": "^0.18.15",
|
|
60
43
|
"turndown": "^7.2.5"
|
|
61
44
|
},
|
|
62
45
|
"peerDependencies": {
|
|
63
|
-
"ai": "^7.0.
|
|
46
|
+
"ai": "^7.0.172",
|
|
64
47
|
"zod": "^4.6.7"
|
|
65
48
|
},
|
|
66
49
|
"peerDependenciesMeta": {
|
|
@@ -87,12 +70,28 @@
|
|
|
87
70
|
"jiti": "^2.7.0",
|
|
88
71
|
"lint-staged": "^17.6.0",
|
|
89
72
|
"npm-check-updates": "^23.1.1",
|
|
90
|
-
"prettier": "^3.
|
|
73
|
+
"prettier": "^3.10.1",
|
|
91
74
|
"rimraf": "^6.1.4",
|
|
92
75
|
"ts-unused-exports": "^11.0.1",
|
|
93
76
|
"tsup": "^8.5.1",
|
|
94
77
|
"typescript": "^5.9.3",
|
|
95
|
-
"typescript-eslint": "^8.72.
|
|
78
|
+
"typescript-eslint": "^8.72.2",
|
|
96
79
|
"vitest": "^5.1.0"
|
|
80
|
+
},
|
|
81
|
+
"scripts": {
|
|
82
|
+
"build": "pnpm tsup",
|
|
83
|
+
"prebuild": "rimraf dist",
|
|
84
|
+
"depcheck": "npx depcheck .",
|
|
85
|
+
"depcruise": "npx dependency-cruiser -c .depcruise.mjs --ts-config tsconfig.json src",
|
|
86
|
+
"format": "prettier --write .",
|
|
87
|
+
"lint": "eslint ./src",
|
|
88
|
+
"lint-staged": "npx lint-staged --allow-empty",
|
|
89
|
+
"ncu:update": "npx npm-check-updates -u --format group --dep prod,dev,optional,packageManager,peer",
|
|
90
|
+
"ncu:interactive": "npx npm-check-updates -u --interactive --format group",
|
|
91
|
+
"ncu:validate": "npx npm-check-updates -e 2 --packageFile=./package.json",
|
|
92
|
+
"test": "vitest run",
|
|
93
|
+
"test:watch": "vitest",
|
|
94
|
+
"test:cov": "vitest run --coverage",
|
|
95
|
+
"lint:unused": "npx ts-unused-exports ./tsconfig.exclude.json --maxIssues=6"
|
|
97
96
|
}
|
|
98
|
-
}
|
|
97
|
+
}
|